public class FieldInfo extends ClassMemberInfo implements Comparable<FieldInfo>
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().
|
Object |
getConstantInitializerValue()
Returns the constant initializer value of a field.
|
String |
getModifiersStr()
Get the field modifiers as a string, e.g.
|
String |
getModifierStr()
Deprecated.
Use
getModifiersStr() instead. |
TypeSignature |
getTypeDescriptor()
Returns the parsed type descriptor 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.
|
int |
hashCode()
Use hash code of class name and field name.
|
boolean |
isEnum()
Returns true if this field is an enum constant.
|
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()
Render to string.
|
String |
toStringWithSimpleNames()
Render to string, using only simple
names for classes.
|
getAnnotationInfo, getAnnotationInfo, getAnnotationInfo, getAnnotationInfoRepeatable, getAnnotationInfoRepeatable, getClassInfo, getClassName, getModifiers, getName, getTypeDescriptorStr, getTypeSignatureOrTypeDescriptorStr, getTypeSignatureStr, hasAnnotation, hasAnnotation, isFinal, isPrivate, isProtected, isPublic, isStatic, isSynthetic
@Deprecated public String getModifierStr()
getModifiersStr()
instead.getModifiersStr()
instead.public String getModifiersStr()
getModifiersStr
in class ClassMemberInfo
public boolean isTransient()
public boolean isEnum()
public TypeSignature getTypeDescriptor()
getTypeSignature()
instead.getTypeDescriptor
in class ClassMemberInfo
public TypeSignature getTypeSignature()
getTypeDescriptor()
instead.getTypeSignature
in class ClassMemberInfo
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 TypeSignature getTypeSignatureOrTypeDescriptor()
getTypeSignatureOrTypeDescriptor
in class ClassMemberInfo
public 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 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.public String toStringWithSimpleNames()
Copyright © 2024. All rights reserved.