1 *java.lang.reflect.AccessibleObject* *AccessibleObject* The AccessibleObject cla
3 public class AccessibleObject
4 extends |java.lang.Object|
5 implements |java.lang.reflect.AnnotatedElement|
7 |java.lang.reflect.AccessibleObject_Description|
8 |java.lang.reflect.AccessibleObject_Fields|
9 |java.lang.reflect.AccessibleObject_Constructors|
10 |java.lang.reflect.AccessibleObject_Methods|
12 ================================================================================
14 *java.lang.reflect.AccessibleObject_Constructors*
15 |java.lang.reflect.AccessibleObject()|Constructor: only used by the Java Virtua
17 *java.lang.reflect.AccessibleObject_Methods*
18 |java.lang.reflect.AccessibleObject.getAnnotation(Class<T>)|
19 |java.lang.reflect.AccessibleObject.getAnnotations()|
20 |java.lang.reflect.AccessibleObject.getDeclaredAnnotations()|
21 |java.lang.reflect.AccessibleObject.isAccessible()|Get the value of the accessi
22 |java.lang.reflect.AccessibleObject.isAnnotationPresent(Class<?extendsAnnotation>)|
23 |java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject[],boolean)|C
24 |java.lang.reflect.AccessibleObject.setAccessible(boolean)|Set the accessible f
26 *java.lang.reflect.AccessibleObject_Description*
28 The AccessibleObject class is the base class for Field, Method and Constructor
29 objects. It provides the ability to flag a reflected object as suppressing
30 default Java language access control checks when it is used. The access
31 checks--for public, default (package) access, protected, and private
32 members--are performed when Fields, Methods or Constructors are used to set or
33 get fields, to invoke methods, or to create and initialize new instances of
34 classes, respectively.
36 Setting the accessible flag in a reflected object permits sophisticated
37 applications with sufficient privilege, such as Java Object Serialization or
38 other persistence mechanisms, to manipulate objects in a manner that would
39 normally be prohibited.
43 *java.lang.reflect.AccessibleObject()*
45 protected AccessibleObject()
47 Constructor: only used by the Java Virtual Machine.
50 *java.lang.reflect.AccessibleObject.getAnnotation(Class<T>)*
52 public |T| getAnnotation(java.lang.Class<T> annotationClass)
58 *java.lang.reflect.AccessibleObject.getAnnotations()*
60 public |java.lang.annotation.Annotation|[] getAnnotations()
66 *java.lang.reflect.AccessibleObject.getDeclaredAnnotations()*
68 public |java.lang.annotation.Annotation|[] getDeclaredAnnotations()
74 *java.lang.reflect.AccessibleObject.isAccessible()*
76 public boolean isAccessible()
78 Get the value of the accessible flag for this object.
82 Returns: the value of the object's accessible flag
84 *java.lang.reflect.AccessibleObject.isAnnotationPresent(Class<?extendsAnnotation>)*
86 public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
92 *java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject[],boolean)*
94 public static void setAccessible(
95 java.lang.reflect.AccessibleObject[] array,
97 throws |java.lang.SecurityException|
99 Convenience method to set the accessible flag for an array of objects with a
100 single security check (for efficiency).
102 First, if there is a security manager, its checkPermission method is called
103 with a ReflectPermission("suppressAccessChecks") permission.
105 A SecurityException is raised if flag is true but accessibility of any of the
106 elements of the input array may not be changed (for example, if the element
107 object is a (|java.lang.reflect.Constructor|) object for the class
108 (|java.lang.Class|) ). In the event of such a SecurityException, the
109 accessibility of objects is set to flag for array elements upto (and excluding)
110 the element for which the exception occurred; the accessibility of elements
111 beyond (and including) the element for which the exception occurred is
115 array - the array of AccessibleObjects
116 flag - the new value for the accessible flag in each object
118 *java.lang.reflect.AccessibleObject.setAccessible(boolean)*
120 public void setAccessible(boolean flag)
121 throws |java.lang.SecurityException|
123 Set the accessible flag for this object to the indicated boolean value. A value
124 of true indicates that the reflected object should suppress Java language
125 access checking when it is used. A value of false indicates that the reflected
126 object should enforce Java language access checks.
128 First, if there is a security manager, its checkPermission method is called
129 with a ReflectPermission("suppressAccessChecks") permission.
131 A SecurityException is raised if flag is true but accessibility of this object
132 may not be changed (for example, if this element object is a
133 (|java.lang.reflect.Constructor|) object for the class (|java.lang.Class|) ).
135 A SecurityException is raised if this object is a
136 (|java.lang.reflect.Constructor|) object for the class java.lang.Class, and
140 flag - the new value for the accessible flag