diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | java/lang/reflect/AccessibleObject.java | 27 |
2 files changed, 32 insertions, 2 deletions
@@ -1,3 +1,10 @@ +2006-04-21 Jeroen Frijters <jeroen@frijters.net> + + * java/lang/reflect/AccessibleObject.java: + Implemented AnnotatedElement. + (getAnnotation, getAnnotations, getDeclaredAnnotations, + isAnnotationPresent): New methods. + 2006-04-17 Andrew John Hughes <gnu_andrew@member.fsf.org> * java/lang/Enum.java: Documented. diff --git a/java/lang/reflect/AccessibleObject.java b/java/lang/reflect/AccessibleObject.java index 24418c971..fd46a53dc 100644 --- a/java/lang/reflect/AccessibleObject.java +++ b/java/lang/reflect/AccessibleObject.java @@ -1,5 +1,5 @@ /* java.lang.reflect.AccessibleObject - Copyright (C) 2001, 2005 Free Software Foundation, Inc. + Copyright (C) 2001, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -38,6 +38,8 @@ exception statement from your version. */ package java.lang.reflect; +import java.lang.annotation.Annotation; + /** * This class is the superclass of various reflection classes, and * allows sufficiently trusted code to bypass normal restrictions to @@ -53,9 +55,10 @@ package java.lang.reflect; * @see Method * @see ReflectPermission * @since 1.2 - * @status updated to 1.4 + * @status updated to 1.5 */ public class AccessibleObject + implements AnnotatedElement { /** * True if this object is marked accessible, which means the reflected @@ -156,4 +159,24 @@ public class AccessibleObject throw new SecurityException("Cannot make object accessible: " + this); this.flag = flag; } + + public <T extends Annotation> T getAnnotation(Class<T> annotationClass) + { + throw new AssertionError("Subclass must override this method"); + } + + public Annotation[] getAnnotations() + { + return getDeclaredAnnotations(); + } + + public Annotation[] getDeclaredAnnotations() + { + throw new AssertionError("Subclass must override this method"); + } + + public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) + { + return getAnnotation(annotationClass) != null; + } } |