|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.api.client.util.FieldInfo
public class FieldInfo
Parses field information to determine data key name/value pair associated with the field.
Implementation is thread-safe.
Method Summary | ||
---|---|---|
|
enumValue()
|
|
ClassInfo |
getClassInfo()
Returns the class information of the field's declaring class. |
|
Field |
getField()
Returns the field. |
|
static Object |
getFieldValue(Field field,
Object obj)
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()
Returns the data key name associated with the field for a non-enum-constant with a 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. |
|
Class<?> |
getType()
Returns the field's type. |
|
Object |
getValue(Object obj)
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.isPrimitive(Type) . |
|
static FieldInfo |
of(Enum<?> enumValue)
Returns the field information for the given enum value. |
|
static FieldInfo |
of(Field field)
Returns the field information for the given field. |
|
static void |
setFieldValue(Field field,
Object obj,
Object value)
Sets to the given value of the given field in the given object instance using reflection. |
|
void |
setValue(Object obj,
Object value)
Sets to the given value of the field in the given object instance using reflection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static FieldInfo of(Enum<?> enumValue)
enumValue
- enum value
IllegalArgumentException
- if the enum value has no value annotationpublic static FieldInfo of(Field field)
field
- field or null
for null
result
null
if the field has no name
or for null
inputpublic Field getField()
public String getName()
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 Type getGenericType()
public boolean isFinal()
public boolean isPrimitive()
Data.isPrimitive(Type)
.
public Object getValue(Object obj)
public void setValue(Object obj, Object value)
If the field is final, it checks that value being set is identical to the existing value.
public ClassInfo getClassInfo()
public <T extends Enum<T>> T enumValue()
public static Object getFieldValue(Field field, Object obj)
public static void setFieldValue(Field field, Object obj, Object value)
If the field is final, it checks that value being set is identical to the existing value.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |