src/share/classes/java/lang/reflect/AccessibleObject.java

Print this page




 165     // outside this package.
 166     boolean override;
 167 
 168     // Reflection factory used by subclasses for creating field,
 169     // method, and constructor accessors. Note that this is called
 170     // very early in the bootstrapping process.
 171     static final ReflectionFactory reflectionFactory =
 172         AccessController.doPrivileged(
 173             new sun.reflect.ReflectionFactory.GetReflectionFactoryAction());
 174 
 175     /**
 176      * @throws NullPointerException {@inheritDoc}
 177      * @since 1.5
 178      */
 179     public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
 180         throw new AssertionError("All subclasses should override this method");
 181     }
 182 
 183     /**
 184      * @throws NullPointerException {@inheritDoc}
 185      * @since 1.5
 186      */
 187     public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) {
 188         return getAnnotation(annotationClass) != null;
 189     }
 190 
 191     /**
 192      * @throws NullPointerException {@inheritDoc}
 193      * @since 1.8
 194      */
 195     public <T extends Annotation> T[] getAnnotations(Class<T> annotationClass) {
 196         throw new AssertionError("All subclasses should override this method");
 197     }
 198 
 199     /**
 200      * @since 1.5
 201      */
 202     public Annotation[] getAnnotations() {
 203         return getDeclaredAnnotations();
 204     }
 205 
 206     /**
 207      * @throws NullPointerException {@inheritDoc}
 208      * @since 1.8
 209      */
 210     public <T extends Annotation> T getDeclaredAnnotation(Class<T> annotationClass) {
 211         // Only annotations on classes are inherited, for all other
 212         // objects getDeclaredAnnotation is the same as




 165     // outside this package.
 166     boolean override;
 167 
 168     // Reflection factory used by subclasses for creating field,
 169     // method, and constructor accessors. Note that this is called
 170     // very early in the bootstrapping process.
 171     static final ReflectionFactory reflectionFactory =
 172         AccessController.doPrivileged(
 173             new sun.reflect.ReflectionFactory.GetReflectionFactoryAction());
 174 
 175     /**
 176      * @throws NullPointerException {@inheritDoc}
 177      * @since 1.5
 178      */
 179     public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
 180         throw new AssertionError("All subclasses should override this method");
 181     }
 182 
 183     /**
 184      * @throws NullPointerException {@inheritDoc}








 185      * @since 1.8
 186      */
 187     public <T extends Annotation> T[] getAnnotations(Class<T> annotationClass) {
 188         throw new AssertionError("All subclasses should override this method");
 189     }
 190 
 191     /**
 192      * @since 1.5
 193      */
 194     public Annotation[] getAnnotations() {
 195         return getDeclaredAnnotations();
 196     }
 197 
 198     /**
 199      * @throws NullPointerException {@inheritDoc}
 200      * @since 1.8
 201      */
 202     public <T extends Annotation> T getDeclaredAnnotation(Class<T> annotationClass) {
 203         // Only annotations on classes are inherited, for all other
 204         // objects getDeclaredAnnotation is the same as