java.lang.reflect
public class AccessibleObject extends Object implements AnnotatedElement
Since: 1.2
See Also: Field Constructor Method ReflectPermission
UNKNOWN: updated to 1.5
Constructor Summary | |
---|---|
protected | AccessibleObject()
Only the three reflection classes that extend this can create an
accessible object. |
Method Summary | |
---|---|
<T extends Annotation> T | getAnnotation(Class<T> annotationClass) |
Annotation[] | getAnnotations() |
Annotation[] | getDeclaredAnnotations() |
boolean | isAccessible()
Return the accessibility status of this object.
|
boolean | isAnnotationPresent(Class<? extends Annotation> annotationClass) |
static void | setAccessible(AccessibleObject[] array, boolean flag)
Convenience method to set the flag on a number of objects with a single
security check. |
void | setAccessible(boolean flag)
Sets the accessibility flag for this reflection object. |
Returns: true if this object bypasses security checks
ReflectPermission("suppressAccessChecks")
.It is forbidden to set the accessibility flag to true on any constructor for java.lang.Class. This will result in a SecurityException. If the SecurityException is thrown for any of the passed AccessibleObjects, the accessibility flag will be set on AccessibleObjects in the array prior to the one which resulted in the exception.
Parameters: array the array of accessible objects flag the desired state of accessibility, true to bypass security
Throws: NullPointerException if array is null SecurityException if the request is denied
See Also: checkPermission RuntimePermission
ReflectPermission("suppressAccessChecks")
.It is forbidden to set the accessibility flag to true on any constructor for java.lang.Class. This will result in a SecurityException.
Parameters: flag the desired state of accessibility, true to bypass security
Throws: NullPointerException if array is null SecurityException if the request is denied
See Also: checkPermission RuntimePermission