Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.lang.reflect

Class AccessibleObject

java.lang.Object
|
+--java.lang.reflect.AccessibleObject


public class AccessibleObject

extends Object

This class is the superclass of various reflection classes, and allows sufficiently trusted code to bypass normal restrictions to do necessary things like invoke private methods outside of the class during Serialization. If you don't have a good reason to mess with this, don't try. Fortunately, there are adequate security checks before you can set a reflection object as accessible.

Since:Authors:See Also:

Constructor Summary

AccessibleObject()

Only the three reflection classes that extend this can create an accessible object.

Method Summary

booleanisAccessible()

Return the accessibility status of this object.
static voidsetAccessible(java.lang.reflect.AccessibleObject array, boolean flag)

Convenience method to set the flag on a number of objects with a single security check.
voidsetAccessible(boolean flag)

Sets the accessibility flag for this reflection object.

Constructor Details

AccessibleObject

protected AccessibleObject()

Only the three reflection classes that extend this can create an accessible object. This is not serializable for security reasons.


Method Details

isAccessible

public boolean isAccessible()

Return the accessibility status of this object.

Returns:


setAccessible

public void setAccessible(boolean flag)

Sets the accessibility flag for this reflection object. If a security manager exists, it is checked for ReflectPermission("suppressAccessChecks").

If flag is true, and the initial security check succeeds, this will still fail for a forbidden object. At the moment, the forbidden members are:

(Sun has not specified others, but good candidates might include ClassLoader, String, and such. However, the more checks we do, the slower this method gets).

Parameters:

Throws:

See Also:


setAccessible

public static void setAccessible(java.lang.reflect.AccessibleObject array, boolean flag)

Convenience method to set the flag on a number of objects with a single security check. If a security manager exists, it is checked for ReflectPermission("suppressAccessChecks").

If flag is true, and the initial security check succeeds, this can still fail if a forbidden object is encountered, leaving the array half-modified. At the moment, the forbidden members are:

(Sun has not specified others, but good candidates might include ClassLoader, String, and such. However, the more checks we do, the slower this method gets).

Parameters:

Throws:

See Also: