|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.gson.FieldAttributes
public final class FieldAttributes
A data object that stores attributes of a field.
This class is immutable; therefore, it can be safely shared across threads.
Method Summary | ||
---|---|---|
|
getAnnotation(Class<T> annotation)
Return the T annotation object from this field if it exist; otherwise returns
null . |
|
Collection<Annotation> |
getAnnotations()
Return the annotations that are present on this field. |
|
Class<?> |
getDeclaredClass()
Returns the Class<?> object that was declared for this field. |
|
Type |
getDeclaredType()
For example, assume the following class definition: public class Foo { private String bar; private List<String> red; } Type listParmeterizedType = new TypeToken |
|
Class<?> |
getDeclaringClass()
|
|
String |
getName()
|
|
boolean |
hasModifier(int modifier)
Returns true if the field is defined with the modifier . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public Class<?> getDeclaringClass()
public String getName()
public Type getDeclaredType()
For example, assume the following class definition:
public class Foo { private String bar; private List<String> red; } Type listParmeterizedType = new TypeToken>() {}.getType();
This method would return String.class
for the bar
field and
listParameterizedType
for the red
field.
public Class<?> getDeclaredClass()
Class<?>
object that was declared for this field.
For example, assume the following class definition:
public class Foo { private String bar; private List<String> red; }
This method would return String.class
for the bar
field and
List.class
for the red
field.
public <T extends Annotation> T getAnnotation(Class<T> annotation)
T
annotation object from this field if it exist; otherwise returns
null
.
annotation
- the class of the annotation that will be retrieved
null
public Collection<Annotation> getAnnotations()
public boolean hasModifier(int modifier)
true
if the field is defined with the modifier
.
This method is meant to be called as:
boolean hasPublicModifier = fieldAttribute.hasModifier(java.lang.reflect.Modifier.PUBLIC);
Modifier
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |