Class SetPropertyClass

  • All Implemented Interfaces:
    java.lang.Comparable<SetPropertyClass>

    public final class SetPropertyClass
    extends java.lang.Object
    implements java.lang.Comparable<SetPropertyClass>
    Represents a class in the reflection-based property setter/getter code generation system. Tracks properties, parent/child class relationships, and generates optimized reflection-free property access code.
    • Method Detail

      • getChildren

        public java.util.Set<SetPropertyClass> getChildren()
        Returns the set of child classes registered under this class.
        Returns:
        the child classes
      • getProperties

        public java.util.Set<org.apache.tomcat.util.xreflection.ReflectionProperty> getProperties()
        Returns the set of reflection properties for this class.
        Returns:
        the reflection properties
      • getGenericSetPropertyMethod

        public java.lang.reflect.Method getGenericSetPropertyMethod()
        Returns the generic setProperty method if one exists.
        Returns:
        the generic setProperty method, or null
      • getGenericGetPropertyMethod

        public java.lang.reflect.Method getGenericGetPropertyMethod()
        Returns the generic getProperty method if one exists.
        Returns:
        the generic getProperty method, or null
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • getParent

        public SetPropertyClass getParent()
        Returns the parent class.
        Returns:
        the parent class, or null if this is the root class
      • getClazz

        public java.lang.Class<?> getClazz()
        Returns the Class represented by this instance.
        Returns:
        the represented class
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • addProperty

        public void addProperty​(org.apache.tomcat.util.xreflection.ReflectionProperty property)
        Add a property to this class.
        Parameters:
        property - the property to add
      • generateSetPropertyMethod

        public java.lang.String generateSetPropertyMethod​(org.apache.tomcat.util.xreflection.ReflectionProperty property)
        Generate a Java code snippet to set the given property value.
        Parameters:
        property - the property to generate code for
        Returns:
        the generated code snippet, or null if no setter is available
      • generateGetPropertyMethod

        public java.lang.String generateGetPropertyMethod​(org.apache.tomcat.util.xreflection.ReflectionProperty property)
        Generate a Java code snippet to get the given property value.
        Parameters:
        property - the property to generate code for
        Returns:
        the generated code snippet, or null if no getter is available
      • generateSetPropertyForMethod

        public java.lang.String generateSetPropertyForMethod()
        Generate a complete setProperty method for this class with switch-case statements for each known property.
        Returns:
        the generated Java source code
      • generateInvocationSetForPropertyCaseStatement

        public java.lang.String generateInvocationSetForPropertyCaseStatement​(int level)
        Generate a switch case statement that invokes the setProperty method for this class.
        Parameters:
        level - the indentation level
        Returns:
        the generated Java source code
      • generateParentSetPropertyForMethodInvocation

        public java.lang.String generateParentSetPropertyForMethodInvocation()
        Generate a method invocation string for the setProperty method of this class, suitable for use from a parent class.
        Returns:
        the generated method invocation string
      • generatesSetPropertyForMethodHeader

        public java.lang.String generatesSetPropertyForMethodHeader()
        Generate the method header for the setProperty method for this class.
        Returns:
        the generated method header string
      • generateInvocationGetForPropertyCaseStatement

        public java.lang.String generateInvocationGetForPropertyCaseStatement​(int level)
        Generate a switch case statement that invokes the getProperty method for this class.
        Parameters:
        level - the indentation level
        Returns:
        the generated Java source code
      • generateParentGetPropertyForMethodInvocation

        public java.lang.String generateParentGetPropertyForMethodInvocation()
        Generate a method invocation string for the getProperty method of this class, suitable for use from a parent class.
        Returns:
        the generated method invocation string
      • generatesGetPropertyForMethodHeader

        public java.lang.String generatesGetPropertyForMethodHeader()
        Generate the method header for the getProperty method for this class.
        Returns:
        the generated method header string
      • generateGetPropertyForMethod

        public java.lang.String generateGetPropertyForMethod()
        Generate a complete getProperty method for this class with switch-case statements for each known property.
        Returns:
        the generated Java source code