public class FieldInfo extends Object
Implementation is thread-safe.
| Modifier and Type | Method and Description |
|---|---|
<T extends Enum |
enumValue()
|
ClassInfo |
getClassInfo()
Returns the class information of the field's declaring class.
|
Field |
getField()
Returns the field.
|
static Object |
getFieldValue(Field
Returns the value of the given field in the given object instance using reflection.
|
Type |
getGenericType()
Returns the field's generic type, which is a class, parameterized type, generic array type, or type variable, but not a wildcard type.
|
String |
getName()
|
Class |
getType()
Returns the field's type.
|
Object |
getValue(Object
Returns the value of the field in the given object instance using reflection.
|
boolean |
isFinal()
Returns whether the field is final.
|
boolean |
isPrimitive()
Returns whether the field is primitive as defined by
Data.
|
static FieldInfo |
of(Enum
Returns the field information for the given enum value.
|
static FieldInfo |
of(Field
Returns the field information for the given field.
|
static void |
setFieldValue(Field
Sets to the given value of the given field in the given object instance using reflection.
|
void |
setValue(Object
Sets to the given value of the field in the given object instance using reflection.
|
public static FieldInfoof(Enum <?> enumValue)
enumValue - enum value
IllegalArgumentException - if the enum value has no value annotation
public static FieldInfoof(Field field)
field - field or
null for
null result
null if the field has no
name or for
null input
public FieldgetField()
public StringgetName()
Key annotation, or data key value associated with the enum constant with a
Value annotation or
null for an enum constant with a
NullValue annotation.
This string is interned.
public Class<?> getType()
public TypegetGenericType()
public boolean isFinal()
public boolean isPrimitive()
Data.isPrimitive(Type) .
public ObjectgetValue(Object obj)
public void setValue(Objectobj, Object value)
If the field is final, it checks that value being set is identical to the existing value.
public ClassInfogetClassInfo()
public <T extends Enum<T>> T enumValue()
public static ObjectgetFieldValue(Field field, Object obj)