Get the value of this Field. If it is primitive, it will be wrapped in the appropriate wrapper type (boolean = java.lang.Boolean).
If the field is static,
o will be ignored. Otherwise, if
o is null, you get a
NullPointerException, and if it is incompatible with the declaring class of the field, you get an
Next, if this Field enforces access control, your runtime context is evaluated, and you may have an
IllegalAccessException if you could not access this field in similar compiled code. If the field is static, and its class is uninitialized, you trigger class initialization, which may end in a
Finally, the field is accessed, and primitives are wrapped (but not necessarily in new objects). This method accesses the field of the declaring class, even if the instance passed in belongs to a subclass which declares another field to hide this one.
|o ||the object to get the value of this Field from |
- the value of the Field
|IllegalAccessException ||if you could not normally access this field (i.e. it is not public) |
|IllegalArgumentException ||if |
o is not an instance of the class or interface declaring this field
|NullPointerException ||if |
o is null and this field requires an instance
|ExceptionInInitializerError ||if accessing a static field triggered class initialization, which then failed |
- See also:
Definition at line 233 of file Field.java.
return getField(o, declaringClass, type, slot);