All Packages Class Hierarchy This Package Previous Next Index
Class java.lang.reflect.AccessibleObject
java.lang.Object
|
+----java.lang.reflect.AccessibleObject
- public class AccessibleObject
- extends Object
The AccessibleObject class is the base class for Field, Method and
Constructor objects. It provides the ability to flag a reflected
object as suppressing default Java language access control checks
when it is used. The access checks--for public, default (package)
access, protected, and private members--are performed when Fields,
Methods or Constructors are used to set or get fields, to invoke
methods, or to create and initialize new instances of classes,
respectively.
Setting the accessible flag in a reflected object
permits sophisticated applications with sufficient privilege, such
as Java Object Serialization or other persistence mechanisms, to
manipulate objects in a manner that would normally be prohibited.
- Since:
- JDK1.2
- See Also:
- Field, Method, Constructor, ReflectPermission
AccessibleObject()
- Constructor: only used by the Java Virtual Machine.
isAccessible()
- Get the value of the accessible flag for this object.
setAccessible(AccessibleObject[], boolean)
- Convenience method to set the accessible flag for an
array of objects with a single security check (for efficiency).
setAccessible(boolean)
- Set the accessible flag for this object to
the indicated boolean value.
AccessibleObject
protected AccessibleObject()
- Constructor: only used by the Java Virtual Machine.
setAccessible
public static void setAccessible(AccessibleObject[] array,
boolean flag) throws SecurityException
- Convenience method to set the accessible flag for an
array of objects with a single security check (for efficiency).
- Parameters:
- array - the array of AccessibleObjects
- flag - the new value for the accessible flag in each object
- Throws:
SecurityException
- if the request is denied
setAccessible
public void setAccessible(boolean flag) throws SecurityException
- Set the accessible flag for this object to
the indicated boolean value. A value of true indicates that
the reflected object should suppress Java language access
checking when it is used. A value of false indicates
that the reflected object should enforce Java language access checks.
- Parameters:
- flag - the new value for the accessible flag
- Throws:
SecurityException
- if the request is denied
isAccessible
public boolean isAccessible()
- Get the value of the accessible flag for this object.
All Packages Class Hierarchy This Package Previous Next Index
Submit a bug or feature