Interface FieldElement

All Superinterfaces:
AnnotatedElement, AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, Described, Element, MemberElement, MutableAnnotationMetadataDelegate<Element>, Named, TypedElement
All Known Subinterfaces:
BeanFieldElement, EnumConstantElement
All Known Implementing Classes:
GroovyEnumConstantElement, GroovyFieldElement

public interface FieldElement extends TypedElement, MemberElement
Stores data about an element that references a field.
James Kleeh
  • Method Details

    • getConstantValue

      default Object getConstantValue()
      Returns the value of this variable if this is a final field initialized to a compile-time constant. Returns null otherwise. The value will be of a primitive type or a String. If the value is of a primitive type, it is wrapped in the appropriate wrapper class (such as Integer).

      Note that not all final fields will have constant values. In particular, enum constants are not considered to be compile-time constants. To have a constant value, a field's type must be either a primitive type or String.

      the value of this variable if this is a final field initialized to a compile-time constant, or null otherwise
    • getGenericField

      default ClassElement getGenericField()
      Obtain the generic type with the associated annotation metadata for the field.
      The generic field
    • getDescription

      @NonNull default @NonNull String getDescription(boolean simple)
      Description copied from interface: Described
      Allows returning a more simple description if requested.
      Specified by:
      getDescription in interface Described
      Specified by:
      getDescription in interface Element
      simple - True if a simple description is required
      The simple description
    • withAnnotationMetadata

      default FieldElement withAnnotationMetadata(AnnotationMetadata annotationMetadata)
      Description copied from interface: Element
      Copies this element and overrides its annotations.
      Specified by:
      withAnnotationMetadata in interface Element
      Specified by:
      withAnnotationMetadata in interface MemberElement
      annotationMetadata - The annotation metadata
      A new element
    • hides

      default boolean hides(@NonNull @NonNull MemberElement memberElement)
      Description copied from interface: MemberElement
      Checks if this member element hides another.
      Specified by:
      hides in interface MemberElement
      memberElement - The possibly hidden element
      true if this member element hides passed field element