This class models a field. Information about the field can be accessed, and the field's value can be accessed dynamically.
Public Member Functions | |
boolean | isSynthetic () |
String | toGenericString () |
boolean | isEnumConstant () |
Type | getGenericType () |
boolean | equals (Object object) |
Compares the specified object to this Field and answer if they are equal. | |
native Object | get (Object object) throws IllegalAccessException, IllegalArgumentException |
Return the value of the field in the specified object. | |
native boolean | getBoolean (Object object) throws IllegalAccessException, IllegalArgumentException |
Return the value of the field in the specified object as a boolean. | |
native byte | getByte (Object object) throws IllegalAccessException, IllegalArgumentException |
Return the value of the field in the specified object as a byte. | |
native char | getChar (Object object) throws IllegalAccessException, IllegalArgumentException |
Return the value of the field in the specified object as a char. | |
Class<?> | getDeclaringClass () |
Return the Class associated with the class that defined this field. | |
native double | getDouble (Object object) throws IllegalAccessException, IllegalArgumentException |
Return the value of the field in the specified object as a double. | |
native float | getFloat (Object object) throws IllegalAccessException, IllegalArgumentException |
Return the value of the field in the specified object as a float. | |
native int | getInt (Object object) throws IllegalAccessException, IllegalArgumentException |
Return the value of the field in the specified object as an int. | |
native long | getLong (Object object) throws IllegalAccessException, IllegalArgumentException |
Return the value of the field in the specified object as a long. | |
native int | getModifiers () |
Return the modifiers for the modeled field. | |
String | getName () |
Return the name of the modeled field. | |
native short | getShort (Object object) throws IllegalAccessException, IllegalArgumentException |
Return the value of the field in the specified object as a short. | |
Class<?> | getType () |
Return the Class associated with the type of this field. | |
int | hashCode () |
Answers an integer hash code for the receiver. | |
native void | set (Object object, Object value) throws IllegalAccessException, IllegalArgumentException |
Set the value of the field in the specified object to the boolean value. | |
native void | setBoolean (Object object, boolean value) throws IllegalAccessException, IllegalArgumentException |
Set the value of the field in the specified object to the boolean value. | |
native void | setByte (Object object, byte value) throws IllegalAccessException, IllegalArgumentException |
Set the value of the field in the specified object to the byte value. | |
native void | setChar (Object object, char value) throws IllegalAccessException, IllegalArgumentException |
Set the value of the field in the specified object to the char value. | |
native void | setDouble (Object object, double value) throws IllegalAccessException, IllegalArgumentException |
Set the value of the field in the specified object to the double value. | |
native void | setFloat (Object object, float value) throws IllegalAccessException, IllegalArgumentException |
Set the value of the field in the specified object to the float value. | |
native void | setInt (Object object, int value) throws IllegalAccessException, IllegalArgumentException |
Set the value of the field in the specified object to the int value. | |
native void | setLong (Object object, long value) throws IllegalAccessException, IllegalArgumentException |
Set the value of the field in the specified object to the long value. | |
native void | setShort (Object object, short value) throws IllegalAccessException, IllegalArgumentException |
Set the value of the field in the specified object to the short value. | |
String | toString () |
Answers a string containing a concise, human-readable description of the receiver. | |
Package Functions | |
native String | getSignature () |
Private Member Functions | |
Field () | |
Prevent this class from being instantiated. |
java.lang.reflect.Field.Field | ( | ) | [private] |
Prevent this class from being instantiated.
native String java.lang.reflect.Field.getSignature | ( | ) | [package] |
TODO Document this method. Is it used?
Reimplemented from java.lang.reflect.AccessibleObject.
String java.lang.reflect.Field.toGenericString | ( | ) |
Returns the String representation of the field's declaration, including the type parameters.
boolean java.lang.reflect.Field.isEnumConstant | ( | ) |
Indicates whether or not this field is an enumeration constant.
true
if this field is an enumeration constant, otherwise false
. Type java.lang.reflect.Field.getGenericType | ( | ) |
Gets the declared type of this field.
GenericSignatureFormatError | if the generic method signature is invalid. | |
TypeNotPresentException | if the component type points to a missing type. | |
MalformedParameterizedTypeException | if the component type points to a type that can't be instantiated for some reason. |
boolean java.lang.reflect.Field.equals | ( | Object | object | ) |
native Object java.lang.reflect.Field.get | ( | Object | object | ) | throws IllegalAccessException, IllegalArgumentException |
Return the value of the field in the specified object.
This reproduces the effect of object.fieldName
If the modeled field is static, the object argument is ignored. Otherwise, if the object is null, a NullPointerException is thrown. If the object is not an instance of the declaring class of the method, an IllegalArgumentException is thrown.
If this Field object is enforcing access control (see AccessibleObject) and the modeled field is not accessible from the current context, an IllegalAccessException is thrown.
The value of the field is returned. If the type of this field is a base type, the field value is automatically wrapped.
object | the object to access |
NullPointerException | if the object is null and the field is non-static | |
IllegalArgumentException | if the object is not compatible with the declaring class | |
IllegalAccessException | if modeled field is not accessible |
native boolean java.lang.reflect.Field.getBoolean | ( | Object | object | ) | throws IllegalAccessException, IllegalArgumentException |
Return the value of the field in the specified object as a boolean.
This reproduces the effect of object.fieldName
If the modeled field is static, the object argument is ignored. Otherwise, if the object is null, a NullPointerException is thrown. If the object is not an instance of the declaring class of the method, an IllegalArgumentException is thrown.
If this Field object is enforcing access control (see AccessibleObject) and the modeled field is not accessible from the current context, an IllegalAccessException is thrown.
object | the object to access |
NullPointerException | if the object is null and the field is non-static | |
IllegalArgumentException | if the object is not compatible with the declaring class | |
IllegalAccessException | if modeled field is not accessible |
native byte java.lang.reflect.Field.getByte | ( | Object | object | ) | throws IllegalAccessException, IllegalArgumentException |
Return the value of the field in the specified object as a byte.
This reproduces the effect of object.fieldName
If the modeled field is static, the object argument is ignored. Otherwise, if the object is null, a NullPointerException is thrown. If the object is not an instance of the declaring class of the method, an IllegalArgumentException is thrown.
If this Field object is enforcing access control (see AccessibleObject) and the modeled field is not accessible from the current context, an IllegalAccessException is thrown.
object | the object to access |
NullPointerException | if the object is null and the field is non-static | |
IllegalArgumentException | if the object is not compatible with the declaring class | |
IllegalAccessException | if modeled field is not accessible |
native char java.lang.reflect.Field.getChar | ( | Object | object | ) | throws IllegalAccessException, IllegalArgumentException |
Return the value of the field in the specified object as a char.
This reproduces the effect of object.fieldName
If the modeled field is static, the object argument is ignored. Otherwise, if the object is null, a NullPointerException is thrown. If the object is not an instance of the declaring class of the method, an IllegalArgumentException is thrown.
If this Field object is enforcing access control (see AccessibleObject) and the modeled field is not accessible from the current context, an IllegalAccessException is thrown.
object | the object to access |
NullPointerException | if the object is null and the field is non-static | |
IllegalArgumentException | if the object is not compatible with the declaring class | |
IllegalAccessException | if modeled field is not accessible |
Class<?> java.lang.reflect.Field.getDeclaringClass | ( | ) |
native double java.lang.reflect.Field.getDouble | ( | Object | object | ) | throws IllegalAccessException, IllegalArgumentException |
Return the value of the field in the specified object as a double.
This reproduces the effect of object.fieldName
If the modeled field is static, the object argument is ignored. Otherwise, if the object is null, a NullPointerException is thrown. If the object is not an instance of the declaring class of the method, an IllegalArgumentException is thrown.
If this Field object is enforcing access control (see AccessibleObject) and the modeled field is not accessible from the current context, an IllegalAccessException is thrown.
object | the object to access |
NullPointerException | if the object is null and the field is non-static | |
IllegalArgumentException | if the object is not compatible with the declaring class | |
IllegalAccessException | if modeled field is not accessible |
native float java.lang.reflect.Field.getFloat | ( | Object | object | ) | throws IllegalAccessException, IllegalArgumentException |
Return the value of the field in the specified object as a float.
This reproduces the effect of object.fieldName
If the modeled field is static, the object argument is ignored. Otherwise, if the object is null, a NullPointerException is thrown. If the object is not an instance of the declaring class of the method, an IllegalArgumentException is thrown.
If this Field object is enforcing access control (see AccessibleObject) and the modeled field is not accessible from the current context, an IllegalAccessException is thrown.
object | the object to access |
NullPointerException | if the object is null and the field is non-static | |
IllegalArgumentException | if the object is not compatible with the declaring class | |
IllegalAccessException | if modeled field is not accessible |
native int java.lang.reflect.Field.getInt | ( | Object | object | ) | throws IllegalAccessException, IllegalArgumentException |
Return the value of the field in the specified object as an int.
This reproduces the effect of object.fieldName
If the modeled field is static, the object argument is ignored. Otherwise, if the object is null, a NullPointerException is thrown. If the object is not an instance of the declaring class of the method, an IllegalArgumentException is thrown.
If this Field object is enforcing access control (see AccessibleObject) and the modeled field is not accessible from the current context, an IllegalAccessException is thrown.
object | the object to access |
NullPointerException | if the object is null and the field is non-static | |
IllegalArgumentException | if the object is not compatible with the declaring class | |
IllegalAccessException | if modeled field is not accessible |
native long java.lang.reflect.Field.getLong | ( | Object | object | ) | throws IllegalAccessException, IllegalArgumentException |
Return the value of the field in the specified object as a long.
This reproduces the effect of object.fieldName
If the modeled field is static, the object argument is ignored. Otherwise, if the object is null, a NullPointerException is thrown. If the object is not an instance of the declaring class of the method, an IllegalArgumentException is thrown.
If this Field object is enforcing access control (see AccessibleObject) and the modeled field is not accessible from the current context, an IllegalAccessException is thrown.
object | the object to access |
NullPointerException | if the object is null and the field is non-static | |
IllegalArgumentException | if the object is not compatible with the declaring class | |
IllegalAccessException | if modeled field is not accessible |
native int java.lang.reflect.Field.getModifiers | ( | ) |
Return the modifiers for the modeled field.
The Modifier class should be used to decode the result.
Reimplemented from java.lang.reflect.AccessibleObject.
String java.lang.reflect.Field.getName | ( | ) |
Return the name of the modeled field.
native short java.lang.reflect.Field.getShort | ( | Object | object | ) | throws IllegalAccessException, IllegalArgumentException |
Return the value of the field in the specified object as a short.
This reproduces the effect of object.fieldName
If the modeled field is static, the object argument is ignored. Otherwise, if the object is null, a NullPointerException is thrown. If the object is not an instance of the declaring class of the method, an IllegalArgumentException is thrown.
If this Field object is enforcing access control (see AccessibleObject) and the modeled field is not accessible from the current context, an IllegalAccessException is thrown.
object | the object to access |
NullPointerException | if the object is null and the field is non-static | |
IllegalArgumentException | if the object is not compatible with the declaring class | |
IllegalAccessException | if modeled field is not accessible |
Class<?> java.lang.reflect.Field.getType | ( | ) |
int java.lang.reflect.Field.hashCode | ( | ) |
native void java.lang.reflect.Field.set | ( | Object | object, | |
Object | value | |||
) | throws IllegalAccessException, IllegalArgumentException |
Set the value of the field in the specified object to the boolean value.
This reproduces the effect of object.fieldName = value
If the modeled field is static, the object argument is ignored. Otherwise, if the object is null, a NullPointerException is thrown. If the object is not an instance of the declaring class of the method, an IllegalArgumentException is thrown.
If this Field object is enforcing access control (see AccessibleObject) and the modeled field is not accessible from the current context, an IllegalAccessException is thrown.
If the field type is a base type, the value is automatically unwrapped. If the unwrap fails, an IllegalArgumentException is thrown. If the value cannot be converted to the field type via a widening conversion, an IllegalArgumentException is thrown.
object | the object to access | |
value | the new value |
NullPointerException | if the object is null and the field is non-static | |
IllegalArgumentException | if the object is not compatible with the declaring class | |
IllegalAccessException | if modeled field is not accessible |
native void java.lang.reflect.Field.setBoolean | ( | Object | object, | |
boolean | value | |||
) | throws IllegalAccessException, IllegalArgumentException |
Set the value of the field in the specified object to the boolean value.
This reproduces the effect of object.fieldName = value
If the modeled field is static, the object argument is ignored. Otherwise, if the object is null, a NullPointerException is thrown. If the object is not an instance of the declaring class of the method, an IllegalArgumentException is thrown.
If this Field object is enforcing access control (see AccessibleObject) and the modeled field is not accessible from the current context, an IllegalAccessException is thrown.
If the value cannot be converted to the field type via a widening conversion, an IllegalArgumentException is thrown.
object | the object to access | |
value | the new value |
NullPointerException | if the object is null and the field is non-static | |
IllegalArgumentException | if the object is not compatible with the declaring class | |
IllegalAccessException | if modeled field is not accessible |
native void java.lang.reflect.Field.setByte | ( | Object | object, | |
byte | value | |||
) | throws IllegalAccessException, IllegalArgumentException |
Set the value of the field in the specified object to the byte value.
This reproduces the effect of object.fieldName = value
If the modeled field is static, the object argument is ignored. Otherwise, if the object is null, a NullPointerException is thrown. If the object is not an instance of the declaring class of the method, an IllegalArgumentException is thrown.
If this Field object is enforcing access control (see AccessibleObject) and the modeled field is not accessible from the current context, an IllegalAccessException is thrown.
If the value cannot be converted to the field type via a widening conversion, an IllegalArgumentException is thrown.
object | the object to access | |
value | the new value |
NullPointerException | if the object is null and the field is non-static | |
IllegalArgumentException | if the object is not compatible with the declaring class | |
IllegalAccessException | if modeled field is not accessible |
native void java.lang.reflect.Field.setChar | ( | Object | object, | |
char | value | |||
) | throws IllegalAccessException, IllegalArgumentException |
Set the value of the field in the specified object to the char value.
This reproduces the effect of object.fieldName = value
If the modeled field is static, the object argument is ignored. Otherwise, if the object is null, a NullPointerException is thrown. If the object is not an instance of the declaring class of the method, an IllegalArgumentException is thrown.
If this Field object is enforcing access control (see AccessibleObject) and the modeled field is not accessible from the current context, an IllegalAccessException is thrown.
If the value cannot be converted to the field type via a widening conversion, an IllegalArgumentException is thrown.
object | the object to access | |
value | the new value |
NullPointerException | if the object is null and the field is non-static | |
IllegalArgumentException | if the object is not compatible with the declaring class | |
IllegalAccessException | if modeled field is not accessible |
native void java.lang.reflect.Field.setDouble | ( | Object | object, | |
double | value | |||
) | throws IllegalAccessException, IllegalArgumentException |
Set the value of the field in the specified object to the double value.
This reproduces the effect of object.fieldName = value
If the modeled field is static, the object argument is ignored. Otherwise, if the object is null, a NullPointerException is thrown. If the object is not an instance of the declaring class of the method, an IllegalArgumentException is thrown.
If this Field object is enforcing access control (see AccessibleObject) and the modeled field is not accessible from the current context, an IllegalAccessException is thrown.
If the value cannot be converted to the field type via a widening conversion, an IllegalArgumentException is thrown.
object | the object to access | |
value | the new value |
NullPointerException | if the object is null and the field is non-static | |
IllegalArgumentException | if the object is not compatible with the declaring class | |
IllegalAccessException | if modeled field is not accessible |
native void java.lang.reflect.Field.setFloat | ( | Object | object, | |
float | value | |||
) | throws IllegalAccessException, IllegalArgumentException |
Set the value of the field in the specified object to the float value.
This reproduces the effect of object.fieldName = value
If the modeled field is static, the object argument is ignored. Otherwise, if the object is null, a NullPointerException is thrown. If the object is not an instance of the declaring class of the method, an IllegalArgumentException is thrown.
If this Field object is enforcing access control (see AccessibleObject) and the modeled field is not accessible from the current context, an IllegalAccessException is thrown.
If the value cannot be converted to the field type via a widening conversion, an IllegalArgumentException is thrown.
object | the object to access | |
value | the new value |
NullPointerException | if the object is null and the field is non-static | |
IllegalArgumentException | if the object is not compatible with the declaring class | |
IllegalAccessException | if modeled field is not accessible |
native void java.lang.reflect.Field.setInt | ( | Object | object, | |
int | value | |||
) | throws IllegalAccessException, IllegalArgumentException |
Set the value of the field in the specified object to the int value.
This reproduces the effect of object.fieldName = value
If the modeled field is static, the object argument is ignored. Otherwise, if the object is null, a NullPointerException is thrown. If the object is not an instance of the declaring class of the method, an IllegalArgumentException is thrown.
If this Field object is enforcing access control (see AccessibleObject) and the modeled field is not accessible from the current context, an IllegalAccessException is thrown.
If the value cannot be converted to the field type via a widening conversion, an IllegalArgumentException is thrown.
object | the object to access | |
value | the new value |
NullPointerException | if the object is null and the field is non-static | |
IllegalArgumentException | if the object is not compatible with the declaring class | |
IllegalAccessException | if modeled field is not accessible |
native void java.lang.reflect.Field.setLong | ( | Object | object, | |
long | value | |||
) | throws IllegalAccessException, IllegalArgumentException |
Set the value of the field in the specified object to the long value.
This reproduces the effect of object.fieldName = value
If the modeled field is static, the object argument is ignored. Otherwise, if the object is null, a NullPointerException is thrown. If the object is not an instance of the declaring class of the method, an IllegalArgumentException is thrown.
If this Field object is enforcing access control (see AccessibleObject) and the modeled field is not accessible from the current context, an IllegalAccessException is thrown.
If the value cannot be converted to the field type via a widening conversion, an IllegalArgumentException is thrown.
object | the object to access | |
value | the new value |
NullPointerException | if the object is null and the field is non-static | |
IllegalArgumentException | if the object is not compatible with the declaring class | |
IllegalAccessException | if modeled field is not accessible |
native void java.lang.reflect.Field.setShort | ( | Object | object, | |
short | value | |||
) | throws IllegalAccessException, IllegalArgumentException |
Set the value of the field in the specified object to the short value.
This reproduces the effect of object.fieldName = value
If the modeled field is static, the object argument is ignored. Otherwise, if the object is null, a NullPointerException is thrown. If the object is not an instance of the declaring class of the method, an IllegalArgumentException is thrown.
If this Field object is enforcing access control (see AccessibleObject) and the modeled field is not accessible from the current context, an IllegalAccessException is thrown.
If the value cannot be converted to the field type via a widening conversion, an IllegalArgumentException is thrown.
object | the object to access | |
value | the new value |
NullPointerException | if the object is null and the field is non-static | |
IllegalArgumentException | if the object is not compatible with the declaring class | |
IllegalAccessException | if modeled field is not accessible |
String java.lang.reflect.Field.toString | ( | ) |
Answers a string containing a concise, human-readable description of the receiver.
The format of the string is:
For example: public static java.io.InputStream java.lang.System.in
Genereated on Tue Dec 9 14:09:48 2008 by Doxygen.
(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.