| |
e110. Overriding Default Access
By default, a reflected object enforces the access as defined by the
Java language. For example, by default you cannot retrieve the value
from a Field object if the Field object represents a private
field. To bypass these access checks, you call setAccessible() on
the reflected object. However, the program may not have permission to
call setAccessible(), in which case SecurityException is thrown.
field.setAccessible(true);
constructor.setAccessible(true);
method.setAccessible(true);
e109.
Getting the Name of a Member Object
e111.
Creating a Proxy Object
© 2002 Addison-Wesley.
| | |