| ★ wanayoo — archive 1999 http://developer.android.com/reference/java/lang/reflect/Field.html | Nouvelle recherche | Portail wanayoo |
| java.lang.Object | ||
| ↳ | java.lang.reflect.AccessibleObject | |
| ↳ | java.lang.reflect.Field | |
This class must be implemented by the VM vendor. This class models a field. Information about the field can be accessed, and the field's value can be accessed dynamically.
|
[Expand]
Inherited Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From interface
java.lang.reflect.Member
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Compares the specified object to this Field and answer if they are equal.
| |||||||||||
Return the value of the field in the specified object.
| |||||||||||
Return the value of the field in the specified object as a boolean.
| |||||||||||
Return the value of the field in the specified object as a byte.
| |||||||||||
Return the value of the field in the specified object as a char.
| |||||||||||
Gets all Annotations that are explicitly declared by this
element (not inherited).
| |||||||||||
Return the Class associated with the class that defined this
field.
| |||||||||||
Return the value of the field in the specified object as a double.
| |||||||||||
Return the value of the field in the specified object as a float.
| |||||||||||
Gets the declared type of this field. | |||||||||||
Return the value of the field in the specified object as an int.
| |||||||||||
Return the value of the field in the specified object as a long.
| |||||||||||
Return the modifiers for the modeled field.
| |||||||||||
Return the name of the modeled field.
| |||||||||||
Return the value of the field in the specified object as a short.
| |||||||||||
Return the Class associated with the type of this field.
| |||||||||||
Returns an integer hash code for the receiver.
| |||||||||||
Indicates whether or not this field is an enumeration constant. | |||||||||||
Indicates whether or not this field is synthetic. | |||||||||||
Set the value of the field in the specified object to the boolean value.
| |||||||||||
Set the value of the field in the specified object to the boolean value.
| |||||||||||
Set the value of the field in the specified object to the byte value.
| |||||||||||
Set the value of the field in the specified object to the char value.
| |||||||||||
Set the value of the field in the specified object to the double value.
| |||||||||||
Set the value of the field in the specified object to the float value.
| |||||||||||
Set the value of the field in the specified object to the int value.
| |||||||||||
Set the value of the field in the specified object to the long value.
| |||||||||||
Set the value of the field in the specified object to the short value.
| |||||||||||
Returns the String representation of the field's declaration, including the type parameters. | |||||||||||
Returns a string containing a concise, human-readable description of the
receiver.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.reflect.AccessibleObject
| |||||||||||
From class java.lang.Object
| |||||||||||
From interface java.lang.reflect.AnnotatedElement
| |||||||||||
From interface java.lang.reflect.Member
| |||||||||||
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.
| object | the object to compare |
|---|
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 |
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 |
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 |
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 |
Gets all Annotations that are explicitly declared by this element (not inherited).
null.
Return the 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 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 |
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 |
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. |
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 |
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 |
Return the modifiers for the modeled field. The Modifier class should be used to decode the result.
Return the name of the modeled field.
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 |
Return the Class associated with the type of this field.
Returns 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.
Indicates whether or not this field is an enumeration constant.
true if this field is an enumeration
constant, otherwise false.Indicates whether or not this field is synthetic.
true if this field is synthetic,
otherwise false.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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Returns the String representation of the field's declaration, including the type parameters.
Returns 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