diff options
author | Jeroen Frijters <jeroen@sumatra.nl> | 2006-04-21 12:49:06 +0000 |
---|---|---|
committer | Jeroen Frijters <jeroen@sumatra.nl> | 2006-04-21 12:49:06 +0000 |
commit | e0c693aea0018220b10032861974dfe447d5783b (patch) | |
tree | ff8b28f1091cfadca70f72d8e0f89088a1dd9954 | |
parent | 673241bffbab36db98574dbfb25572a5348a8d00 (diff) | |
download | classpath-e0c693aea0018220b10032861974dfe447d5783b.tar.gz |
2006-04-21 Jeroen Frijters <jeroen@frijters.net>
* java/lang/reflect/AccessibleObject.java:
Implemented AnnotatedElement.
(getAnnotation, getAnnotations, getDeclaredAnnotations,
isAnnotationPresent): New methods.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | java/lang/reflect/AccessibleObject.java | 29 |
2 files changed, 35 insertions, 3 deletions
@@ -1,7 +1,14 @@ +2006-04-21 Jeroen Frijters <jeroen@frijters.net> + + * java/lang/reflect/AccessibleObject.java: + Implemented AnnotatedElement. + (getAnnotation, getAnnotations, getDeclaredAnnotations, + isAnnotationPresent): New methods. + 2006-04-21 David Gilbert <david.gilbert@object-refinery.com> * javax/swing/border/AbstractBorder.java: API doc updates, - * javax/swing/border/BevelBorder.java: Likewise, + * javax/swing/border/BevelBorder.java: Likewise, * javax/swing/border/CompoundBorder.java: Likewise, * javax/swing/border/EtchedBorder.java: Likewise, * javax/swing/border/LineBorder.java: Likewise, diff --git a/java/lang/reflect/AccessibleObject.java b/java/lang/reflect/AccessibleObject.java index 24418c971..8f09eac1b 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,26 @@ public class AccessibleObject throw new SecurityException("Cannot make object accessible: " + this); this.flag = flag; } + + /* FIXME[GENERICS]: <T extends Annotation> T getAnnotation(Class <T>) */ + public Annotation getAnnotation(Class 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"); + } + + /* FIXME[GENERICS]: Signature is Class<? extends Annotation> */ + public boolean isAnnotationPresent(Class annotationClass) + { + return getAnnotation(annotationClass) != null; + } } |