|
||||||||||
| 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.
| Field Summary | |
|---|---|
Field |
field
Deprecated. (scheduled to be made private in 1.5) Use getField() |
boolean |
isFinal
Deprecated. (scheduled to be removed in 1.5) Use isFinal() |
boolean |
isPrimitive
Deprecated. (scheduled to be made private in 1.5) Use isPrimitive() |
String |
name
Deprecated. (scheduled to be made private in 1.5) Use getName() |
Class<?> |
type
Deprecated. (scheduled to be removed in 1.5) Use getType() |
| 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 boolean |
isPrimitive(Class<?> fieldClass)
Deprecated. (scheduled to be removed in 1.5) Use Data.isPrimitive(Type) |
|
static boolean |
isPrimitive(Object fieldValue)
Deprecated. (scheduled to be removed in 1.5) Use Data.isPrimitive(Type) on the
Object.getClass() |
|
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 Object |
parsePrimitiveValue(Class<?> primitiveClass,
String stringValue)
Deprecated. (scheduled to be removed in 1.5) Use Data.parsePrimitiveValue(Type, String) |
|
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 |
| Field Detail |
|---|
@Deprecated public final boolean isFinal
isFinal()
@Deprecated public final boolean isPrimitive
isPrimitive()Data.isPrimitive(Type).
@Deprecated public final Class<?> type
getType()
@Deprecated public final Field field
getField()
@Deprecated public final String name
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.
| 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()
@Deprecated public static boolean isPrimitive(Class<?> fieldClass)
Data.isPrimitive(Type)
@Deprecated public static boolean isPrimitive(Object fieldValue)
Data.isPrimitive(Type) on the
Object.getClass()
null or its class is primitive as defined by
isPrimitive(Class).
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.
@Deprecated
public static Object parsePrimitiveValue(Class<?> primitiveClass,
String stringValue)
Data.parsePrimitiveValue(Type, String)
Types are parsed as follows:
null or String: no parsingchar or Character: String.charAt(0) (requires
length to be exactly 1)boolean or Boolean: Boolean.valueOf(String)byte or Byte: Byte.valueOf(String)short or Short: Short.valueOf(String)int or Integer: Integer.valueOf(String)long or Long: Long.valueOf(String)float or Float: Float.valueOf(String)double or Double: Double.valueOf(String)BigInteger: BigInteger(String)BigDecimal: BigDecimal(String)DateTime: DateTime.parseRfc3339(String)
primitiveClass - primitive class (see isPrimitive(Class) or null to parse
as a stringstringValue - string value to parse or null for null result
null for null input
IllegalArgumentException - if the given class is not a primitive class as defined by
isPrimitive(Class)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||