|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.reflect.AccessibleObject
java.lang.reflect.Field
public final class Field
Field enables reflection access to Java fields.
| Field Summary |
|---|
| Fields inherited from interface java.lang.reflect.Member |
|---|
DECLARED, PUBLIC |
| Method Summary | ||
|---|---|---|
boolean |
equals(Object obj)
equals checks if this field is equal to another field. |
|
Object |
get(Object obj)
get returns the value of this field. |
|
|
getAnnotation(Class<T> annotationType)
getAnnotation NYI: COMMENT: JDK 1.5 method description |
|
boolean |
getBoolean(Object obj)
getBoolean returns the value of this boolean field. |
|
byte |
getByte(Object obj)
getByte returns the value of this byte field. |
|
char |
getChar(Object obj)
getChar returns the value of this char field. |
|
Annotation[] |
getDeclaredAnnotations()
getDeclaredAnnotations NYI: COMMENT: JDK 1.5 method description |
|
Class<?> |
getDeclaringClass()
getDeclaringClass returns the class this field was declared in. |
|
double |
getDouble(Object obj)
getDouble returns the value of this doublue field. |
|
float |
getFloat(Object obj)
getFloat returns the value of this float field. |
|
Type |
getGenericType()
getGenericType NYI: COMMENT: JDK 1.5 method description |
|
int |
getInt(Object obj)
getInt returns the value of this int field. |
|
long |
getLong(Object obj)
getLong returns the value of this long field. |
|
int |
getModifiers()
getModifiers returns the set of modifiers set for this field. |
|
String |
getName()
getName returns the name of this field. |
|
short |
getShort(Object obj)
getShort returns the value of this short field. |
|
Class<?> |
getType()
getType returns the type of this field. |
|
int |
hashCode()
hashCode returns a hash code for this field |
|
boolean |
isEnumConstant()
isEnumConstant NYI: COMMENT: JDK 1.5 method description |
|
boolean |
isSynthetic()
isSynthetic NYI: COMMENT: JDK 1.5 method description |
|
void |
set(Object o,
Object v)
set sets the value of this field. |
|
void |
setBoolean(Object obj,
boolean z)
setBoolean sets the value of this field. |
|
void |
setByte(Object obj,
byte b)
setByte sets the value of this field. |
|
void |
setChar(Object obj,
char c)
setChar sets the value of this field. |
|
void |
setDouble(Object obj,
double d)
setDouble sets the value of this field. |
|
void |
setFloat(Object obj,
float f)
setFloat sets the value of this field. |
|
void |
setInt(Object obj,
int i)
setInt sets the value of this field. |
|
void |
setLong(Object obj,
long l)
setLong sets the value of this field. |
|
void |
setShort(Object obj,
short s)
setShort sets the value of this field. |
|
String |
toGenericString()
toGenericString NYI: COMMENT: JDK 1.5 method description |
|
String |
toString()
toString converts this field to a string such as "public java.io.PrintStream java.lang.System.out". |
|
| Methods inherited from class java.lang.reflect.AccessibleObject |
|---|
getAnnotations, isAccessible, isAnnotationPresent, setAccessible, setAccessible |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.lang.reflect.AnnotatedElement |
|---|
getAnnotations, isAnnotationPresent |
| Method Detail |
|---|
public Class<?> getDeclaringClass()
getDeclaringClass in interface MemberMember.getDeclaringClass()public String getName()
getName in interface Memberpublic int getModifiers()
getModifiers in interface MemberModifierpublic Class<?> getType()
public boolean equals(Object obj)
equals in class Objectobj - another object
public int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
public Object get(Object obj)
throws IllegalArgumentException,
IllegalAccessException
obj - the instance to take this value from in case of an
instance field. Ignored in case of a static field access.
IllegalArgumentException - if this is an instance field and
obj is not an instance of getDeclaringClass().
IllegalAccessException - if the caller does not have the
right to access this field.
NullPointerException - if this is an instance field and obj
is null.
ExceptionInInitializerError - if this is a static field and
initialization of the declaring class failed.
public boolean getBoolean(Object obj)
throws IllegalArgumentException,
IllegalAccessException
obj - the instance to take this value from in case of an
instance field. Ignored in case of a static field access.
IllegalArgumentException - if this is an instance field and
obj is not an instance of getDeclaringClass() or this field's
type is not boolean.
IllegalAccessException - if the caller does not have the
right to access this field.
NullPointerException - if this is an instance field and obj
is null.
ExceptionInInitializerError - if this is a static field and
initialization of the declaring class failed.
public byte getByte(Object obj)
throws IllegalArgumentException,
IllegalAccessException
obj - the instance to take this value from in case of an
instance field. Ignored in case of a static field access.
IllegalArgumentException - if this is an instance field and
obj is not an instance of getDeclaringClass() or this field's
type is not byte.
IllegalAccessException - if the caller does not have the
right to access this field.
NullPointerException - if this is an instance field and obj
is null.
ExceptionInInitializerError - if this is a static field and
initialization of the declaring class failed.
public char getChar(Object obj)
throws IllegalArgumentException,
IllegalAccessException
obj - the instance to take this value from in case of an
instance field. Ignored in case of a static field access.
IllegalArgumentException - if this is an instance field and
obj is not an instance of getDeclaringClass() or this field's
type is not char.
IllegalAccessException - if the caller does not have the
right to access this field.
NullPointerException - if this is an instance field and obj
is null.
ExceptionInInitializerError - if this is a static field and
initialization of the declaring class failed.
public short getShort(Object obj)
throws IllegalArgumentException,
IllegalAccessException
obj - the instance to take this value from in case of an
instance field. Ignored in case of a static field access.
IllegalArgumentException - if this is an instance field and
obj is not an instance of getDeclaringClass() or this field's
type is not short.
IllegalAccessException - if the caller does not have the
right to access this field.
NullPointerException - if this is an instance field and obj
is null.
ExceptionInInitializerError - if this is a static field and
initialization of the declaring class failed.
public int getInt(Object obj)
throws IllegalArgumentException,
IllegalAccessException
obj - the instance to take this value from in case of an
instance field. Ignored in case of a static field access.
IllegalArgumentException - if this is an instance field and
obj is not an instance of getDeclaringClass() or this field's
type is not int.
IllegalAccessException - if the caller does not have the
right to access this field.
NullPointerException - if this is an instance field and obj
is null.
ExceptionInInitializerError - if this is a static field and
initialization of the declaring class failed.
public long getLong(Object obj)
throws IllegalArgumentException,
IllegalAccessException
obj - the instance to take this value from in case of an
instance field. Ignored in case of a static field access.
IllegalArgumentException - if this is an instance field and
obj is not an instance of getDeclaringClass() or this field's
type is not long.
IllegalAccessException - if the caller does not have the
right to access this field.
NullPointerException - if this is an instance field and obj
is null.
ExceptionInInitializerError - if this is a static field and
initialization of the declaring class failed.
public float getFloat(Object obj)
throws IllegalArgumentException,
IllegalAccessException
obj - the instance to take this value from in case of an
instance field. Ignored in case of a static field access.
IllegalArgumentException - if this is an instance field and
obj is not an instance of getDeclaringClass() or this field's
type is not float.
IllegalAccessException - if the caller does not have the
right to access this field.
NullPointerException - if this is an instance field and obj
is null.
ExceptionInInitializerError - if this is a static field and
initialization of the declaring class failed.
public double getDouble(Object obj)
throws IllegalArgumentException,
IllegalAccessException
obj - the instance to take this value from in case of an
instance field. Ignored in case of a static field access.
IllegalArgumentException - if this is an instance field and
obj is not an instance of getDeclaringClass() or this field's
type is not double.
IllegalAccessException - if the caller does not have the
right to access this field.
NullPointerException - if this is an instance field and obj
is null.
ExceptionInInitializerError - if this is a static field and
initialization of the declaring class failed.
public void set(Object o,
Object v)
throws IllegalArgumentException,
IllegalAccessException
o - the instance containing the field to be set in case of
an instance field. Ignored in case of a static field access.v - the new value of the field, boxed in case a field of
primitive type is set.
IllegalArgumentException - if this is an instance field and
o is not an instance of getDeclaringClass() or if value could
not be converted to the field type with a widening conversion.
IllegalAccessException - if the caller does not have the
right to access this field.
NullPointerException - if this is an instance field and o
is null.
ExceptionInInitializerError - if this is a static field and
initialization of the declaring class failed.
public void setBoolean(Object obj,
boolean z)
throws IllegalArgumentException,
IllegalAccessException
obj - the instance containing the field to be set in case of
an instance field. Ignored in case of a static field access.z - the new value of the field.
IllegalArgumentException - if this is an instance field and
o is not an instance of getDeclaringClass() or if this field's
type is not boolean.
IllegalAccessException - if the caller does not have the
right to access this field.
NullPointerException - if this is an instance field and o
is null.
ExceptionInInitializerError - if this is a static field and
initialization of the declaring class failed.
public void setByte(Object obj,
byte b)
throws IllegalArgumentException,
IllegalAccessException
obj - the instance containing the field to be set in case of
an instance field. Ignored in case of a static field access.b - the new value of the field.
IllegalArgumentException - if this is an instance field and
o is not an instance of getDeclaringClass() or if this field's
type is not byte.
IllegalAccessException - if the caller does not have the
right to access this field.
NullPointerException - if this is an instance field and o
is null.
ExceptionInInitializerError - if this is a static field and
initialization of the declaring class failed.
public void setChar(Object obj,
char c)
throws IllegalArgumentException,
IllegalAccessException
obj - the instance containing the field to be set in case of
an instance field. Ignored in case of a static field access.c - the new value of the field.
IllegalArgumentException - if this is an instance field and
o is not an instance of getDeclaringClass() or if this field's
type is not char.
IllegalAccessException - if the caller does not have the
right to access this field.
NullPointerException - if this is an instance field and o
is null.
ExceptionInInitializerError - if this is a static field and
initialization of the declaring class failed.
public void setShort(Object obj,
short s)
throws IllegalArgumentException,
IllegalAccessException
obj - the instance containing the field to be set in case of
an instance field. Ignored in case of a static field access.s - the new value of the field.
IllegalArgumentException - if this is an instance field and
o is not an instance of getDeclaringClass() or if this field's
type is not short.
IllegalAccessException - if the caller does not have the
right to access this field.
NullPointerException - if this is an instance field and o
is null.
ExceptionInInitializerError - if this is a static field and
initialization of the declaring class failed.
public void setInt(Object obj,
int i)
throws IllegalArgumentException,
IllegalAccessException
obj - the instance containing the field to be set in case of
an instance field. Ignored in case of a static field access.i - the new value of the field.
IllegalArgumentException - if this is an instance field and
o is not an instance of getDeclaringClass() or if this field's
type is not int.
IllegalAccessException - if the caller does not have the
right to access this field.
NullPointerException - if this is an instance field and o
is null.
ExceptionInInitializerError - if this is a static field and
initialization of the declaring class failed.
public void setLong(Object obj,
long l)
throws IllegalArgumentException,
IllegalAccessException
obj - the instance containing the field to be set in case of
an instance field. Ignored in case of a static field access.l - the new value of the field.
IllegalArgumentException - if this is an instance field and
o is not an instance of getDeclaringClass() or if this field's
type is not long.
IllegalAccessException - if the caller does not have the
right to access this field.
NullPointerException - if this is an instance field and o
is null.
ExceptionInInitializerError - if this is a static field and
initialization of the declaring class failed.
public void setFloat(Object obj,
float f)
throws IllegalArgumentException,
IllegalAccessException
obj - the instance containing the field to be set in case of
an instance field. Ignored in case of a static field access.f - the new value of the field.
IllegalArgumentException - if this is an instance field and
o is not an instance of getDeclaringClass() or if this field's
type is not float.
IllegalAccessException - if the caller does not have the
right to access this field.
NullPointerException - if this is an instance field and o
is null.
ExceptionInInitializerError - if this is a static field and
initialization of the declaring class failed.
public void setDouble(Object obj,
double d)
throws IllegalArgumentException,
IllegalAccessException
obj - the instance containing the field to be set in case of
an instance field. Ignored in case of a static field access.d - the new value of the field.
IllegalArgumentException - if this is an instance field and
o is not an instance of getDeclaringClass() or if this field's
type is not double.
IllegalAccessException - if the caller does not have the
right to access this field.
NullPointerException - if this is an instance field and o
is null.
ExceptionInInitializerError - if this is a static field and
initialization of the declaring class failed.public boolean isEnumConstant()
NYI: COMMENT: JDK 1.5 method description
public boolean isSynthetic()
NYI: COMMENT: JDK 1.5 method description
isSynthetic in interface Memberpublic Type getGenericType()
NYI: COMMENT: JDK 1.5 method description
public String toGenericString()
NYI: COMMENT: JDK 1.5 method description
public <T extends Annotation> T getAnnotation(Class<T> annotationType)
NYI: COMMENT: JDK 1.5 method description
getAnnotation in interface AnnotatedElementgetAnnotation in class AccessibleObjectannotationType -
public Annotation[] getDeclaredAnnotations()
NYI: COMMENT: JDK 1.5 method description
getDeclaredAnnotations in interface AnnotatedElementgetDeclaredAnnotations in class AccessibleObject
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||