AccessibleObject


AccessibleObject java.lang.reflect

Java 1.2

This class is the superclass of the Method , Constructor , and Field classes; its methods provide a mechanism for trusted applications to work with private , protected , and default visibility members that would otherwise not be accessible through the Reflection API. This class is new as of Java 1.2; in Java 1.1, the Method , Constructor , and Field classes extended Object directly.

To use the java.lang.reflect package to access a member to which your code would not normally have access, pass TRue to the setAccessible( ) method. If your code has an appropriate ReflectPermission (such as "suppressAccessChecks"), this allows access to the member as if it were declared public . The static version of setAccessible( ) is a convenience method that sets the accessible flag for an array of members but performs only a single security check.

Figure 10-91. java.lang.reflect.AccessibleObject

 public class  AccessibleObject  implements AnnotatedElement {  // Protected Constructors  protected  AccessibleObject  ( );  // Public Class Methods  public static void  setAccessible  (AccessibleObject[ ]  array  , boolean  flag  )       throws SecurityException;  // Public Instance Methods  public boolean  isAccessible  ( );        public void  setAccessible  (boolean  flag  ) throws SecurityException;  // Methods Implementing AnnotatedElement   5.0  public <T extends java.lang.annotation.Annotation> T  getAnnotation  (Class<T>  annotationClass  );  5.0  public java.lang.annotation.Annotation[ ]  getAnnotations  ( );  5.0  public java.lang.annotation.Annotation[ ]  getDeclaredAnnotations  ( );  5.0  public boolean  isAnnotationPresent  (Class<? extends java.lang.annotation. Annotation>  annotationClass  );   } 

Subclasses

Constructor , Field , Method



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net