Main Page | Class Hierarchy | Class List | Directories | Class Members | Related Pages

java.lang.reflect.AccessibleObject Class Reference

Inheritance diagram for java.lang.reflect.AccessibleObject:

java.lang.reflect.Constructor java.lang.reflect.Field java.lang.reflect.Method List of all members.

Detailed Description

This class must be implemented by the vm vendor.

This class is the superclass of all member reflect classes (Field, Constructor, Method). AccessibleObject provides the ability to toggle access checks for these objects. By default accessing a member (for example, setting a field or invoking a method) checks the validity of the access (for example, invoking a private method from outside the defining class is prohibited) and throws IllegalAccessException if the operation is not permitted. If the accessible flag is set to true, these checks are omitted. This allows privileged applications such as Java Object Serialization, inspectors, and debuggers to have complete access to objects.

See also:
Field

Constructor

Method

ReflectPermission


Public Member Functions

boolean isAccessible ()
 Returns the value of the accessible flag.
void setAccessible (boolean flag) throws SecurityException
 Attempts to set the value of the accessible flag.

Static Public Member Functions

static void setAccessible (AccessibleObject[] objects, boolean flag) throws SecurityException
 Attempts to set the value of the accessible flag for all the objects in the array provided.

Protected Member Functions

 AccessibleObject ()
 AccessibleObject constructor.

Package Functions

void invokeV (Object receiver, Object args[]) throws InvocationTargetException
Object invokeL (Object receiver, Object args[]) throws InvocationTargetException
int invokeI (Object receiver, Object args[]) throws InvocationTargetException
long invokeJ (Object receiver, Object args[]) throws InvocationTargetException
float invokeF (Object receiver, Object args[]) throws InvocationTargetException
double invokeD (Object receiver, Object args[]) throws InvocationTargetException
native Class[] getParameterTypesImpl ()
native int getModifiers ()
native Class[] getExceptionTypesImpl ()
native String getSignature ()
native boolean checkAccessibility (Class senderClass, Object receiver)

Static Package Functions

static Object[] marshallArguments (Class[] parameterTypes, Object[] args) throws IllegalArgumentException
static native void initializeClass (Class clazz)
static final native Class getStackClass (int depth)
 Answer the class at depth.

Static Package Attributes

static final Object[] emptyArgs = new Object[0]


Constructor & Destructor Documentation

java.lang.reflect.AccessibleObject.AccessibleObject  )  [protected]
 

AccessibleObject constructor.

AccessibleObjects can only be created by the Virtual Machine.


Member Function Documentation

boolean java.lang.reflect.AccessibleObject.isAccessible  ) 
 

Returns the value of the accessible flag.

This is false if access checks are performed, true if they are skipped.

Returns:
the value of the accessible flag

static void java.lang.reflect.AccessibleObject.setAccessible AccessibleObject[]  objects,
boolean  flag
throws SecurityException [static]
 

Attempts to set the value of the accessible flag for all the objects in the array provided.

Only one security check is performed. Setting this flag to false will enable access checks, setting to true will disable them. If there is a security manager, checkPermission is called with a ReflectPermission("suppressAccessChecks").

Parameters:
objects the accessible objects
flag the new value for the accessible flag
See also:
setAccessible(boolean)

ReflectPermission

Exceptions:
SecurityException if the request is denied

void java.lang.reflect.AccessibleObject.setAccessible boolean  flag  )  throws SecurityException
 

Attempts to set the value of the accessible flag.

Setting this flag to false will enable access checks, setting to true will disable them. If there is a security manager, checkPermission is called with a ReflectPermission("suppressAccessChecks").

Parameters:
flag the new value for the accessible flag
See also:
ReflectPermission
Exceptions:
SecurityException if the request is denied

static final native Class java.lang.reflect.AccessibleObject.getStackClass int  depth  )  [static, package]
 

Answer the class at depth.

Notes: 1) This method operates on the defining classes of methods on stack. NOT the classes of receivers. 2) The item at index zero describes the caller of this method.


The documentation for this class was generated from the following file:
(c) Copyright 2005 The Apache Software Foundation or its licensors, as applicable.