public class FieldInfo extends Object implements Comparable<FieldInfo>, HasName
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(FieldInfo other)
Sort in order of class name then field name.
|
boolean |
equals(Object obj)
Use class name and field name for equals().
|
AnnotationInfoList |
getAnnotationInfo()
Get a list of annotations on this field, along with any annotation parameter values, wrapped in
AnnotationInfo objects. |
AnnotationInfo |
getAnnotationInfo(String annotationName)
Get a the named non-
Repeatable annotation on this field, or null if the field does not have the named
annotation. |
AnnotationInfoList |
getAnnotationInfoRepeatable(String annotationName)
Get a the named
Repeatable annotation on this field, or the empty list if the field does not have the
named annotation. |
ClassInfo |
getClassInfo()
Get the
ClassInfo object for the declaring class (i.e. the class that declares this field). |
Object |
getConstantInitializerValue()
Returns the constant initializer value of a constant final field.
|
int |
getModifiers()
Returns the modifier bits for the field.
|
String |
getModifierStr()
Get the field modifiers as a string, e.g.
|
String |
getName()
Get the name of the field.
|
TypeSignature |
getTypeDescriptor()
Returns the parsed type descriptor for the field, if available.
|
TypeSignature |
getTypeSignature()
Returns the parsed type signature for the field, if available.
|
TypeSignature |
getTypeSignatureOrTypeDescriptor()
Returns the type signature for the field, possibly including type parameters.
|
boolean |
hasAnnotation(String annotationName)
Check if the field has a given named annotation.
|
int |
hashCode()
Use hash code of class name and field name.
|
boolean |
isFinal()
Returns true if this field is final.
|
boolean |
isPublic()
Returns true if this field is public.
|
boolean |
isStatic()
Returns true if this field is static.
|
boolean |
isTransient()
Returns true if this field is a transient field.
|
Field |
loadClassAndGetField()
Load the class this field is associated with, and get the
Field reference for this field. |
String |
toString() |
public String getName()
public ClassInfo getClassInfo()
ClassInfo object for the declaring class (i.e. the class that declares this field).ClassInfo object for the declaring class (i.e. the class that declares this field), or
null if the class representing the type of the field was not encountered during scanning.public String getModifierStr()
public boolean isPublic()
public boolean isStatic()
public boolean isFinal()
public boolean isTransient()
public int getModifiers()
public TypeSignature getTypeDescriptor()
public TypeSignature getTypeSignature()
public TypeSignature getTypeSignatureOrTypeDescriptor()
public Object getConstantInitializerValue()
ClassGraph.enableStaticFinalFieldConstantInitializerValues() to have been called.public AnnotationInfoList getAnnotationInfo()
AnnotationInfo objects.AnnotationInfo objects, or the empty list if none.public AnnotationInfo getAnnotationInfo(String annotationName)
Repeatable annotation on this field, or null if the field does not have the named
annotation. (Use getAnnotationInfoRepeatable(String) for Repeatable annotations.)annotationName - The annotation name.AnnotationInfo object representing the named annotation on this field, or null if the
field does not have the named annotation.public AnnotationInfoList getAnnotationInfoRepeatable(String annotationName)
Repeatable annotation on this field, or the empty list if the field does not have the
named annotation.annotationName - The annotation name.AnnotationInfoList of all instances of the named annotation on this field, or the empty
list if the field does not have the named annotation.public boolean hasAnnotation(String annotationName)
annotationName - The name of an annotation.public Field loadClassAndGetField() throws IllegalArgumentException
Field reference for this field.Field reference for this field.IllegalArgumentException - if the field does not exist.public boolean equals(Object obj)
public int hashCode()
public int compareTo(FieldInfo other)
compareTo in interface Comparable<FieldInfo>other - the other FieldInfo object to compare to.Copyright © 2019. All rights reserved.