Inheritance diagram for java.lang.reflect.Field:
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 | 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 java.lang.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 modelled field. | |
String | getName () |
Return the name of the modelled 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 java.lang.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 () |
|
Compares the specified object to this Field and answer if they are equal. The object must be an instance of Field with the same defining class and name.
|
|
Return the value of the field in the specified object.
This reproduces the effect of If the modelled 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 modelled 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.
|
|
Return the value of the field in the specified object as a boolean.
This reproduces the effect of If the modelled 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 modelled field is not accessible from the current context, an IllegalAccessException is thrown.
|
|
Return the value of the field in the specified object as a byte.
This reproduces the effect of If the modelled 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 modelled field is not accessible from the current context, an IllegalAccessException is thrown.
|
|
Return the value of the field in the specified object as a char.
This reproduces the effect of If the modelled 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 modelled field is not accessible from the current context, an IllegalAccessException is thrown.
|
|
Return the java.lang.Class associated with the class that defined this field.
|
|
Return the value of the field in the specified object as a double.
This reproduces the effect of If the modelled 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 modelled field is not accessible from the current context, an IllegalAccessException is thrown.
|
|
Return the value of the field in the specified object as a float.
This reproduces the effect of If the modelled 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 modelled field is not accessible from the current context, an IllegalAccessException is thrown.
|
|
Return the value of the field in the specified object as an int.
This reproduces the effect of If the modelled 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 modelled field is not accessible from the current context, an IllegalAccessException is thrown.
|
|
Return the value of the field in the specified object as a long.
This reproduces the effect of If the modelled 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 modelled field is not accessible from the current context, an IllegalAccessException is thrown.
|
|
Return the modifiers for the modelled field. The Modifier class should be used to decode the result.
Reimplemented from java.lang.reflect.AccessibleObject. |
|
Return the name of the modelled field.
|
|
Return the value of the field in the specified object as a short.
This reproduces the effect of If the modelled 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 modelled field is not accessible from the current context, an IllegalAccessException is thrown.
|
|
Return the java.lang.Class associated with the type of this field.
|
|
Answers an integer hash code for the receiver. Objects which are equal answer the same value for this method. The hash code for a Field is the hash code of the field's name.
|
|
Set the value of the field in the specified object to the boolean value.
This reproduces the effect of If the modelled 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 modelled 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.
|
|
Set the value of the field in the specified object to the boolean value.
This reproduces the effect of If the modelled 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 modelled 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.
|
|
Set the value of the field in the specified object to the byte value.
This reproduces the effect of If the modelled 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 modelled 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.
|
|
Set the value of the field in the specified object to the char value.
This reproduces the effect of If the modelled 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 modelled 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.
|
|
Set the value of the field in the specified object to the double value.
This reproduces the effect of If the modelled 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 modelled 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.
|
|
Set the value of the field in the specified object to the float value.
This reproduces the effect of If the modelled 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 modelled 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.
|
|
Set the value of the field in the specified object to the int value.
This reproduces the effect of If the modelled 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 modelled 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.
|
|
Set the value of the field in the specified object to the long value.
This reproduces the effect of If the modelled 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 modelled 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.
|
|
Set the value of the field in the specified object to the short value.
This reproduces the effect of If the modelled 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 modelled 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.
|
|
Answers a string containing a concise, human-readable description of the receiver. The format of the string is:
For example:
|