| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Class<?> |
classRef
The class ref, once the class is loaded.
|
protected ScanResult |
scanResult
The scan result.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(FieldInfo other)
Sort in order of class name then field name.
|
boolean |
equals(java.lang.Object obj)
Use class name and field name for equals().
|
protected void |
findReferencedClassInfo(java.util.Map<java.lang.String,ClassInfo> classNameToClassInfo,
java.util.Set<ClassInfo> refdClassInfo,
LogNode log)
Get
ClassInfo objects for any classes referenced in the type descriptor or type signature. |
AnnotationInfoList |
getAnnotationInfo()
Get a list of annotations on this field, along with any annotation parameter values, wrapped in
AnnotationInfo objects. |
AnnotationInfo |
getAnnotationInfo(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Get a the non-
Repeatable annotation on this field, or null if the field does not have the annotation. |
AnnotationInfo |
getAnnotationInfo(java.lang.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(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Get a the
Repeatable annotation on this field, or the empty list if the field does not have the
annotation. |
AnnotationInfoList |
getAnnotationInfoRepeatable(java.lang.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 class that declares this field. |
java.lang.String |
getClassName()
Get the name of the class that declares this field.
|
java.lang.Object |
getConstantInitializerValue()
Returns the constant initializer value of a field.
|
int |
getModifiers()
Returns the modifier bits for the field.
|
java.lang.String |
getModifiersStr()
Get the field modifiers as a string, e.g.
|
java.lang.String |
getModifierStr()
Deprecated.
Use
getModifiersStr() instead. |
java.lang.String |
getName()
Get the name of the field.
|
TypeSignature |
getTypeDescriptor()
Returns the parsed type descriptor for the field, which will not include type parameters.
|
java.lang.String |
getTypeDescriptorStr()
Returns the type descriptor string for the field, which will not include type parameters.
|
TypeSignature |
getTypeSignature()
Returns the parsed type signature for the field, possibly including type parameters.
|
TypeSignature |
getTypeSignatureOrTypeDescriptor()
Returns the type signature for the field, possibly including type parameters.
|
java.lang.String |
getTypeSignatureOrTypeDescriptorStr()
Returns the type signature string for the field, possibly including type parameters.
|
java.lang.String |
getTypeSignatureStr()
Returns the type signature string for the field, possibly including type parameters.
|
boolean |
hasAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Check if the field has a given annotation.
|
boolean |
hasAnnotation(java.lang.String annotationName)
Check if the field has a given named annotation.
|
int |
hashCode()
Use hash code of class name and field name.
|
boolean |
isEnum()
Returns true if this field is an enum constant.
|
boolean |
isFinal()
Returns true if this field is final.
|
boolean |
isPrivate()
Returns true if this field is private.
|
boolean |
isProtected()
Returns true if this field is protected.
|
boolean |
isPublic()
Returns true if this field is public.
|
boolean |
isStatic()
Returns true if this field is static.
|
boolean |
isSynthetic()
Returns true if this field is synthetic.
|
boolean |
isTransient()
Returns true if this field is a transient field.
|
java.lang.reflect.Field |
loadClassAndGetField()
Load the class this field is associated with, and get the
Field reference for this field. |
java.lang.String |
toString()
Render to string.
|
protected void |
toString(boolean useSimpleNames,
java.lang.StringBuilder buf)
Render to string.
|
java.lang.String |
toStringWithSimpleNames()
Render to string, using only simple
names for classes.
|
protected transient ScanResult scanResult
protected transient java.lang.Class<?> classRef
public java.lang.String getName()
public ClassInfo getClassInfo()
ClassInfo object for the class that declares this field.ClassInfo object for the declaring class.getClassName()@Deprecated public java.lang.String getModifierStr()
getModifiersStr() instead.getModifiersStr() instead.public java.lang.String getModifiersStr()
public boolean isPublic()
public boolean isPrivate()
public boolean isProtected()
public boolean isStatic()
public boolean isFinal()
public boolean isTransient()
public boolean isSynthetic()
public boolean isEnum()
public int getModifiers()
public TypeSignature getTypeDescriptor()
getTypeSignature() instead.public java.lang.String getTypeDescriptorStr()
getTypeSignatureStr() instead.public TypeSignature getTypeSignature()
getTypeDescriptor()
instead.java.lang.IllegalArgumentException - if the field type signature cannot be parsed (this should only be thrown in the case of classfile
corruption, or a compiler bug that causes an invalid type signature to be written to the
classfile).public java.lang.String getTypeSignatureStr()
getTypeDescriptorStr() instead.public TypeSignature getTypeSignatureOrTypeDescriptor()
public java.lang.String getTypeSignatureOrTypeDescriptorStr()
public java.lang.Object getConstantInitializerValue()
ClassGraph.enableStaticFinalFieldConstantInitializerValues() to have been called. Will only return
non-null for fields that have constant initializers, which is usually only fields of primitive type, or
String constants. Also note that it is up to the compiler as to whether or not a constant-valued field is
assigned as a constant in the field definition itself, or whether it is assigned manually in static or
non-static class initializer blocks or the constructor -- so your mileage may vary in being able to extract
constant initializer values.public AnnotationInfoList getAnnotationInfo()
AnnotationInfo objects.AnnotationInfo objects, or the empty list if none.public AnnotationInfo getAnnotationInfo(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Repeatable annotation on this field, or null if the field does not have the annotation.
(Use getAnnotationInfoRepeatable(Class) for Repeatable annotations.)annotation - The annotation.AnnotationInfo object representing the annotation on this field, or null if the field does
not have the annotation.public AnnotationInfo getAnnotationInfo(java.lang.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(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Repeatable annotation on this field, or the empty list if the field does not have the
annotation.annotation - The annotation.AnnotationInfoList of all instances of the annotation on this field, or the empty list if
the field does not have the annotation.public AnnotationInfoList getAnnotationInfoRepeatable(java.lang.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(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
annotation - The annotation.public boolean hasAnnotation(java.lang.String annotationName)
annotationName - The name of an annotation.public java.lang.reflect.Field loadClassAndGetField()
throws java.lang.IllegalArgumentException
Field reference for this field.Field reference for this field.java.lang.IllegalArgumentException - if the field does not exist.public java.lang.String getClassName()
getClassInfo()protected void findReferencedClassInfo(java.util.Map<java.lang.String,ClassInfo> classNameToClassInfo, java.util.Set<ClassInfo> refdClassInfo, LogNode log)
ClassInfo objects for any classes referenced in the type descriptor or type signature.classNameToClassInfo - the map from class name to ClassInfo.refdClassInfo - the referenced class infolog - the logpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - the object to compare topublic int hashCode()
hashCode in class java.lang.Objectpublic int compareTo(FieldInfo other)
compareTo in interface java.lang.Comparable<FieldInfo>other - the other FieldInfo object to compare to.protected void toString(boolean useSimpleNames,
java.lang.StringBuilder buf)
useSimpleNames - if true, use just the simple name of each class.buf - the bufpublic java.lang.String toStringWithSimpleNames()
public java.lang.String toString()
toString in class java.lang.Object