All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----java.lang.reflect.Field
A Field permits widening conversions to occur during a get or set access operation, but throws an IllegalArgumentException if a narrowing conversion would occur.
public Class getDeclaringClass()
public String getName()
public int getModifiers()
public Class getType()
public boolean equals(Object obj)
public int hashCode()
public String toString()
public static final int java.lang.Thread.MIN_PRIORITY
private int java.io.FileDescriptor.fd
The modifiers are placed in canonical order as specified by "The Java Language Specification". This is public, protected or private first, and then other modifiers in the following order: static, final, transient, volatile.
public Object get(Object obj) throws IllegalArgumentException, IllegalAccessException
The underlying field's value is obtained as follows:
If the underlying field is a static field, the object argument is ignored; it may be null.
Otherwise, the underlying field is an instance field. If the specified object argument is null, the method throws a NullPointerException. If the specified object is not an instance of the class or interface declaring the underlying field, the method throws an IllegalArgumentException.
If this Field object enforces Java language access control, and the underlying field is inaccessible, the method throws an IllegalAccessException.
Otherwise, the value is retrieved from the underlying instance or static field. If the field has a primitive type, the value is wrapped in an object before being returned, otherwise it is returned as is.
public boolean getBoolean(Object obj) throws IllegalArgumentException, IllegalAccessException
If the field value cannot be converted to the return type by a widening conversion, throws an IllegalArgumentException.
public byte getByte(Object obj) throws IllegalArgumentException, IllegalAccessException
If the field value cannot be converted to the return type by a widening conversion, throws an IllegalArgumentException.
public char getChar(Object obj) throws IllegalArgumentException, IllegalAccessException
If the field value cannot be converted to the return type by a widening conversion, throws an IllegalArgumentException.
public short getShort(Object obj) throws IllegalArgumentException, IllegalAccessException
If the field value cannot be converted to the return type by a widening conversion, throws an IllegalArgumentException.
public int getInt(Object obj) throws IllegalArgumentException, IllegalAccessException
If the field value cannot be converted to the return type by a widening conversion, throws an IllegalArgumentException.
public long getLong(Object obj) throws IllegalArgumentException, IllegalAccessException
public float getFloat(Object obj) throws IllegalArgumentException, IllegalAccessException
If the field value cannot be converted to the return type by a widening conversion, throws an IllegalArgumentException.
public double getDouble(Object obj) throws IllegalArgumentException, IllegalAccessException
If the field value cannot be converted to the return type by a widening conversion, throws an IllegalArgumentException.
public void set(Object obj,
Object value) throws IllegalArgumentException, IllegalAccessException
The operation proceeds as follows:
If the underlying field is static, the object argument is ignored; it may be null.
Otherwise the underlying field is an instance field. If the specified object argument is null, the method throws a NullPointerException. If the specified object argument is not an instance of the class or interface declaring the underlying field, the method throws an IllegalArgumentException.
If this Field object enforces Java language access control, and the underlying field is inaccessible, the method throws an IllegalAccessException.
If the underlying field is final, the method throws an IllegalAccessException.
If the underlying field is of a primitive type, an unwrapping conversion is attempted to convert the new value to a value of a primitive type. If this attempt fails, the method throws an IllegalArgumentException.
If, after possible unwrapping, the new value cannot be converted to the type of the underlying field by an identity or widening conversion, the method throws an IllegalArgumentException.
The field is set to the possibly unwrapped and widened new value.
public void setBoolean(Object obj,
boolean z) throws IllegalArgumentException, IllegalAccessException
public void setByte(Object obj,
byte b) throws IllegalArgumentException, IllegalAccessException
public void setChar(Object obj,
char c) throws IllegalArgumentException, IllegalAccessException
public void setShort(Object obj,
short s) throws IllegalArgumentException, IllegalAccessException
public void setInt(Object obj,
int i) throws IllegalArgumentException, IllegalAccessException
public void setLong(Object obj,
long l) throws IllegalArgumentException, IllegalAccessException
public void setFloat(Object obj,
float f) throws IllegalArgumentException, IllegalAccessException
public void setDouble(Object obj,
double d) throws IllegalArgumentException, IllegalAccessException
All Packages Class Hierarchy This Package Previous Next Index