SetPropertyClass (Apache Tomcat 11.0.24 API Documentation)
Description: declaration: package: org.apache.tomcat.util.xreflection, class: SetPropertyClass

# Class SetPropertyClass

java.lang.Object
org.apache.tomcat.util.xreflection.SetPropertyClass

All Implemented Interfaces:
  `Comparable<SetPropertyClass>`

public final class SetPropertyClass extends Object implements 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 Summary

  Modifier and Type
  Method
  Description
  `void`
  `addProperty(org.apache.tomcat.util.xreflection.ReflectionProperty property)`
  Add a property to this class.
  `int`
  `compareTo(SetPropertyClass o)`
  `boolean`
  `equals(Object o)`
  `String`
  `generateGetPropertyForMethod()`
  Generate a complete getProperty method for this class with switch-case statements for each known property.
  `String`
  `generateGetPropertyMethod(org.apache.tomcat.util.xreflection.ReflectionProperty property)`
  Generate a Java code snippet to get the given property value.
  `String`
  `generateInvocationGetForPropertyCaseStatement(int level)`
  Generate a switch case statement that invokes the getProperty method for this class.
  `String`
  `generateInvocationSetForPropertyCaseStatement(int level)`
  Generate a switch case statement that invokes the setProperty method for this class.
  `String`
  `generateParentGetPropertyForMethodInvocation()`
  Generate a method invocation string for the getProperty method of this class, suitable for use from a parent class.
  `String`
  `generateParentSetPropertyForMethodInvocation()`
  Generate a method invocation string for the setProperty method of this class, suitable for use from a parent class.
  `String`
  `generateSetPropertyForMethod()`
  Generate a complete setProperty method for this class with switch-case statements for each known property.
  `String`
  `generateSetPropertyMethod(org.apache.tomcat.util.xreflection.ReflectionProperty property)`
  Generate a Java code snippet to set the given property value.
  `String`
  `generatesGetPropertyForMethodHeader()`
  Generate the method header for the getProperty method for this class.
  `String`
  `generatesSetPropertyForMethodHeader()`
  Generate the method header for the setProperty method for this class.
  `Set<SetPropertyClass>`
  `getChildren()`
  Returns the set of child classes registered under this class.
  `Class<?>`
  `getClazz()`
  Returns the `Class` represented by this instance.
  `Method`
  `getGenericGetPropertyMethod()`
  Returns the generic getProperty method if one exists.
  `Method`
  `getGenericSetPropertyMethod()`
  Returns the generic setProperty method if one exists.
  `SetPropertyClass`
  `getParent()`
  Returns the parent class.
  `Set<org.apache.tomcat.util.xreflection.ReflectionProperty>`
  `getProperties()`
  Returns the set of reflection properties for this class.
  `int`
  `hashCode()`
  `String`
  `toString()`

  ### Methods inherited from class Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Method Details

  - ### getChildren

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

  - ### getProperties

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

  - ### getGenericSetPropertyMethod

    public Method getGenericSetPropertyMethod()
    Returns the generic setProperty method if one exists.
    Returns:
      the generic setProperty method, or `null`

  - ### getGenericGetPropertyMethod

    public Method getGenericGetPropertyMethod()
    Returns the generic getProperty method if one exists.
    Returns:
      the generic getProperty method, or `null`

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### getParent

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

  - ### getClazz

    public Class<?> getClazz()
    Returns the `Class` represented by this instance.
    Returns:
      the represented class

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `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 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 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 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 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 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 String generatesSetPropertyForMethodHeader()
    Generate the method header for the setProperty method for this class.
    Returns:
      the generated method header string

  - ### generateInvocationGetForPropertyCaseStatement

    public 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 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 String generatesGetPropertyForMethodHeader()
    Generate the method header for the getProperty method for this class.
    Returns:
      the generated method header string

  - ### generateGetPropertyForMethod

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

  - ### compareTo

    public int compareTo(SetPropertyClass o)
    Specified by:
      `compareTo` in interface `Comparable<SetPropertyClass>`