Interface AnnotationProperty


public interface AnnotationProperty
A property of an annotation. A property has a value. It may also contain a reference to a constant that defines its value, for example when generating the annotation into source code.

Support types are defined on Annotation.

  • Method Details

    • create

      static AnnotationProperty create(Object value)
      Create a new annotation property.
      Parameters:
      value - value of the property, must be one of the supported types, see Annotation; must not be an instance of this class
      Returns:
      a new annotation property
      See Also:
    • create

      static AnnotationProperty create(Object value, TypeName constantType, String constantName)
      Create a new annotation property with a constant value. Constant value can be used when generating code.
      Parameters:
      value - value of the property, must be one of the supported types, see Annotation; must not be an instance of this class
      constantType - type of the class that holds the referenced constant
      constantName - name of the constant (i.e. an accessible static final field)
      Returns:
      a new annotation property
      See Also:
    • create

      static <T extends Enum<T>> AnnotationProperty create(Class<T> type, T value)
      Create a new enum property.
      Type Parameters:
      T - type of the enum
      Parameters:
      type - enum type
      value - enum value constant
      Returns:
      new enum value
    • value

      Object value()
      Value of the property, never null.
      Returns:
      value of the property