summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorJeroen Frijters <jeroen@sumatra.nl>2006-04-21 09:41:44 +0000
committerJeroen Frijters <jeroen@sumatra.nl>2006-04-21 09:41:44 +0000
commit429627ad923c4ad26031679827c0cfc8f49c0801 (patch)
tree36e56da0bd57f9145d617cad658a666967e49af6 /java
parenta7a66a5476accfc7eed978ab50f844326f049d3b (diff)
downloadclasspath-429627ad923c4ad26031679827c0cfc8f49c0801.tar.gz
2006-04-21 Jeroen Frijters <jeroen@frijters.net>
* java/lang/reflect/AccessibleObject.java: Implemented AnnotatedElement. (getAnnotation, getAnnotations, getDeclaredAnnotations, isAnnotationPresent): New methods.
Diffstat (limited to 'java')
-rw-r--r--java/lang/reflect/AccessibleObject.java27
1 files changed, 25 insertions, 2 deletions
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;
+ }
}