java.lang.reflect.AccessibleObject Class Reference

Inheritance diagram for java.lang.reflect.AccessibleObject:

java.lang.reflect.Constructor< T > 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

Since:
1.2

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.
boolean isAnnotationPresent (Class<?extends Annotation > annotationType)
Annotation[] getDeclaredAnnotations ()
Annotation[] getAnnotations ()

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

native Class[] getParameterTypesImpl ()
native int getModifiers ()
native Class[] getExceptionTypesImpl ()
native String getSignature ()
native boolean checkAccessibility (Class<?> senderClass, Object receiver)
public< T extends Annotation > T getAnnotation (Class< T > annotationType)
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

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]
 TODO Is this necessary?

Constructor & Destructor Documentation

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

AccessibleObject constructor.

AccessibleObjects can only be created by the Virtual Machine.


Member Function Documentation

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

static Object [] java.lang.reflect.AccessibleObject.marshallArguments ( Class[]  parameterTypes,
Object[]  args 
) throws IllegalArgumentException [static, package]

TODO Document this method.

Parameters:
parameterTypes 
args 
Returns:
Exceptions:
IllegalArgumentException 

static native void java.lang.reflect.AccessibleObject.initializeClass ( Class<?>  clazz  )  [static, package]

TODO Document this method.

Parameters:
clazz 

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.

native Class [] java.lang.reflect.AccessibleObject.getParameterTypesImpl (  )  [package]

TODO Document this method.

Returns:

native int java.lang.reflect.AccessibleObject.getModifiers (  )  [package]

TODO Document this method.

Returns:

Reimplemented in java.lang.reflect.Constructor< T >, java.lang.reflect.Field, and java.lang.reflect.Method.

native Class [] java.lang.reflect.AccessibleObject.getExceptionTypesImpl (  )  [package]

TODO Document this method.

Returns:

native String java.lang.reflect.AccessibleObject.getSignature (  )  [package]

TODO Document this method.

Returns:

Reimplemented in java.lang.reflect.Field.

native boolean java.lang.reflect.AccessibleObject.checkAccessibility ( Class<?>  senderClass,
Object  receiver 
) [package]

TODO Document this method.

Parameters:
senderClass 
receiver 
Returns:

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

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

void java.lang.reflect.AccessibleObject.invokeV ( Object  receiver,
Object  args[] 
) throws InvocationTargetException [package]

TODO Document this method.

Parameters:
receiver 
args 
Exceptions:
InvocationTargetException 

Object java.lang.reflect.AccessibleObject.invokeL ( Object  receiver,
Object  args[] 
) throws InvocationTargetException [package]

TODO Document this method.

Parameters:
receiver 
args 
Returns:
Exceptions:
InvocationTargetException 

int java.lang.reflect.AccessibleObject.invokeI ( Object  receiver,
Object  args[] 
) throws InvocationTargetException [package]

TODO Document this method.

Parameters:
receiver 
args 
Returns:
Exceptions:
InvocationTargetException 

long java.lang.reflect.AccessibleObject.invokeJ ( Object  receiver,
Object  args[] 
) throws InvocationTargetException [package]

TODO Document this method.

Parameters:
receiver 
args 
Returns:
Exceptions:
InvocationTargetException 

float java.lang.reflect.AccessibleObject.invokeF ( Object  receiver,
Object  args[] 
) throws InvocationTargetException [package]

TODO Document this method.

Parameters:
receiver 
args 
Returns:
Exceptions:
InvocationTargetException 

double java.lang.reflect.AccessibleObject.invokeD ( Object  receiver,
Object  args[] 
) throws InvocationTargetException [package]

TODO Document this method.

Parameters:
receiver 
args 
Returns:
Exceptions:
InvocationTargetException 


Member Data Documentation

final Object [] java.lang.reflect.AccessibleObject.emptyArgs = new Object[0] [static, package]

TODO Is this necessary?


The documentation for this class was generated from the following file:

Genereated on Tue Dec 9 14:09:48 2008 by Doxygen.

(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.