Class FieldInfo

  • All Implemented Interfaces:
    Comparable<FieldInfo>

    public class FieldInfo
    extends Object
    implements Comparable<FieldInfo>
    Holds metadata about fields of a class encountered during a scan. All values are taken directly out of the classfile for the class.
    • Field Detail

      • scanResult

        protected transient ScanResult scanResult
    • Method Detail

      • getName

        public String getName()
        Returns the name of the field.
        Returns:
        The name of the field.
      • getDefiningClassName

        public String getDefiningClassName()
        Get the name of the class this field is defined within.
        Returns:
        The name of the class this field is defined within.
      • getDefiningClassInfo

        public ClassInfo getDefiningClassInfo()
        Get the class this field is defined within.
        Returns:
        The class this field is defined within.
      • getModifierStr

        public String getModifierStr()
        Get the field modifiers as a string, e.g. "public static final". For the modifier bits, call getModifiers().
        Returns:
        The field modifiers, as a string.
      • isPublic

        public boolean isPublic()
        Returns true if this field is public.
        Returns:
        True if the field is public.
      • isStatic

        public boolean isStatic()
        Returns true if this field is static.
        Returns:
        True if the field is static.
      • isFinal

        public boolean isFinal()
        Returns true if this field is final.
        Returns:
        True if the field is final.
      • isTransient

        public boolean isTransient()
        Returns true if this field is a transient field.
        Returns:
        True if the field is transient.
      • getModifiers

        public int getModifiers()
        Returns the modifier bits for the field.
        Returns:
        The modifier bits.
      • getTypeDescriptor

        public TypeSignature getTypeDescriptor()
        Returns the parsed type descriptor for the field, if available.
        Returns:
        The parsed type descriptor for the field, if available, else returns null.
      • getTypeSignature

        public TypeSignature getTypeSignature()
        Returns the parsed type signature for the field, if available.
        Returns:
        The parsed type signature for the field, if available, else returns null.
      • getTypeSignatureOrTypeDescriptor

        public TypeSignature getTypeSignatureOrTypeDescriptor()
        Returns the type signature for the field, possibly including type parameters. If the type signature is null, indicating that no type signature information is available for this field, returns the type descriptor instead.
        Returns:
        The parsed type signature for the field, or if not available, the parsed type descriptor for the field.
      • getConstantInitializerValue

        public Object getConstantInitializerValue()
        Returns the constant initializer value of a constant final field. Requires ClassGraph.enableStaticFinalFieldConstantInitializerValues() to have been called.
        Returns:
        The initializer value, if this is a static final field, and has a constant initializer value, or null if none.
      • getAnnotationInfo

        public AnnotationInfoList getAnnotationInfo()
        Get a list of annotations on this field, along with any annotation parameter values, wrapped in AnnotationInfo objects.
        Returns:
        A list of annotations on this field, along with any annotation parameter values, wrapped in AnnotationInfo objects, or the empty list if none.
      • getClassName

        protected String getClassName()
        Returns the defining class name, so that super.getClassInfo() returns the ClassInfo object for the defining class.
      • getClassNamesFromTypeDescriptors

        protected void getClassNamesFromTypeDescriptors​(Set<String> classNames)
        Get the names of any classes in the type descriptor or type signature.
      • equals

        public boolean equals​(Object obj)
        Use class name and field name for equals().
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Use hash code of class name and field name.
        Overrides:
        hashCode in class Object