public final class Field extends Object
| Modifier and Type | Method and Description |
|---|---|
Object |
get(Object obj)
Returns the value of the field on the supplied object.
|
Annotation |
getDeclaredAnnotation(Class<? extends Annotation> annotationType)
Returns an
Annotation object reflecting the annotation provided, or null of this field doesn't
have such an annotation. |
Class |
getDeclaringClass()
Returns the Class object representing the class or interface that declares the field.
|
String |
getName()
Returns the name of the field.
|
Class |
getType()
Returns a Class object that identifies the declared type for the field.
|
boolean |
isFinal()
Return true if the field includes the
final modifier. |
boolean |
isPrivate()
Return true if the field includes the
private modifier. |
boolean |
isProtected()
Return true if the field includes the
protected modifier. |
boolean |
isPublic()
Return true if the field includes the
public modifier. |
boolean |
isStatic()
Return true if the field includes the
static modifier. |
void |
set(Object obj,
Object value)
Sets the value of the field on the supplied object.
|
void |
setAccessible(boolean accessible) |
public String getName()
public Class getType()
public Class getDeclaringClass()
public void setAccessible(boolean accessible)
public boolean isFinal()
final modifier.public boolean isPrivate()
private modifier.public boolean isProtected()
protected modifier.public boolean isPublic()
public modifier.public boolean isStatic()
static modifier.public Annotation getDeclaredAnnotation(Class<? extends Annotation> annotationType)
Annotation object reflecting the annotation provided, or null of this field doesn't
have such an annotation. This is a convenience function if the caller knows already which annotation
type he's looking for.public Object get(Object obj) throws ReflectionException
ReflectionExceptionpublic void set(Object obj, Object value) throws ReflectionException
ReflectionExceptionCopyright © 2017. All rights reserved.