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)|
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)|
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.
42 *java.lang.reflect.AccessibleObject()*
44 protected AccessibleObject()
46 Constructor: only used by the Java Virtual Machine.
49 *java.lang.reflect.AccessibleObject.getAnnotation(Class)*
51 public |java.lang.annotation.Annotation| getAnnotation(java.lang.Class annotationClass)
56 *java.lang.reflect.AccessibleObject.getAnnotations()*
58 public |java.lang.annotation.Annotation| getAnnotations()
63 *java.lang.reflect.AccessibleObject.getDeclaredAnnotations()*
65 public |java.lang.annotation.Annotation| getDeclaredAnnotations()
70 *java.lang.reflect.AccessibleObject.isAccessible()*
72 public boolean isAccessible()
74 Get the value of the accessible flag for this object.
77 Returns: the value of the object's accessible flag
78 *java.lang.reflect.AccessibleObject.isAnnotationPresent(Class)*
80 public boolean isAnnotationPresent(java.lang.Class annotationClass)
85 *java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject[],boolean)*
87 public static void setAccessible(
88 java.lang.reflect.AccessibleObject[] array,
90 throws |java.lang.SecurityException|
92 Convenience method to set the accessible flag for an array of objects with a
93 single security check (for efficiency).
95 First, if there is a security manager, its checkPermission method is called
96 with a ReflectPermission("suppressAccessChecks") permission.
98 A SecurityException is raised if flag is true but accessibility of any of the
99 elements of the input array may not be changed (for example, if the element
100 object is a (|java.lang.reflect.Constructor|) object for the class
101 (|java.lang.Class|) ). In the event of such a SecurityException, the
102 accessibility of objects is set to flag for array elements upto (and excluding)
103 the element for which the exception occurred; the accessibility of elements
104 beyond (and including) the element for which the exception occurred is
107 array - the array of AccessibleObjects
108 flag - the new value for the accessible flag in each object
110 *java.lang.reflect.AccessibleObject.setAccessible(boolean)*
112 public void setAccessible(boolean flag)
113 throws |java.lang.SecurityException|
115 Set the accessible flag for this object to the indicated boolean value. A value
116 of true indicates that the reflected object should suppress Java language
117 access checking when it is used. A value of false indicates that the reflected
118 object should enforce Java language access checks.
120 First, if there is a security manager, its checkPermission method is called
121 with a ReflectPermission("suppressAccessChecks") permission.
123 A SecurityException is raised if flag is true but accessibility of this object
124 may not be changed (for example, if this element object is a
125 (|java.lang.reflect.Constructor|) object for the class (|java.lang.Class|) ).
127 A SecurityException is raised if this object is a
128 (|java.lang.reflect.Constructor|) object for the class java.lang.Class, and
131 flag - the new value for the accessible flag