summaryrefslogtreecommitdiff
path: root/libjava/classpath/java/lang/reflect/AccessibleObject.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/java/lang/reflect/AccessibleObject.java')
-rw-r--r--libjava/classpath/java/lang/reflect/AccessibleObject.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/libjava/classpath/java/lang/reflect/AccessibleObject.java b/libjava/classpath/java/lang/reflect/AccessibleObject.java
index fd46a53dc8c..328f81d7933 100644
--- a/libjava/classpath/java/lang/reflect/AccessibleObject.java
+++ b/libjava/classpath/java/lang/reflect/AccessibleObject.java
@@ -160,21 +160,72 @@ public class AccessibleObject
this.flag = flag;
}
+ /**
+ * <p>
+ * Returns the element's annotation for the specified annotation type,
+ * or <code>null</code> if no such annotation exists.
+ * </p>
+ * <p>
+ * <strong>This method must be overridden by subclasses to provide
+ * appropriate behaviour.</strong>
+ * </p>
+ *
+ * @param annotationClass the type of annotation to look for.
+ * @return this element's annotation for the specified type, or
+ * <code>null</code> if no such annotation exists.
+ * @throws NullPointerException if the annotation class is <code>null</code>.
+ */
public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
{
throw new AssertionError("Subclass must override this method");
}
+ /**
+ * Returns all annotations associated with the element. If there are
+ * no annotations associated with the element, then a zero-length array
+ * will be returned. The returned array may be modified by the client
+ * code, but this will have no effect on the annotation content of the
+ * element, and hence no effect on the return value of this method for
+ * future callers.
+ *
+ * @return this element's annotations.
+ */
public Annotation[] getAnnotations()
{
return getDeclaredAnnotations();
}
+ /**
+ * <p>
+ * Returns all annotations directly defined by the element. If there are
+ * no annotations directly associated with the element, then a zero-length
+ * array will be returned. The returned array may be modified by the client
+ * code, but this will have no effect on the annotation content of this
+ * class, and hence no effect on the return value of this method for
+ * future callers.
+ * </p>
+ * <p>
+ * <strong>This method must be overridden by subclasses to provide
+ * appropriate behaviour.</strong>
+ * </p>
+ *
+ * @return the annotations directly defined by the element.
+ * @since 1.5
+ */
public Annotation[] getDeclaredAnnotations()
{
throw new AssertionError("Subclass must override this method");
}
+ /**
+ * Returns true if an annotation for the specified type is associated
+ * with the element. This is primarily a short-hand for using marker
+ * annotations.
+ *
+ * @param annotationClass the type of annotation to look for.
+ * @return true if an annotation exists for the specified type.
+ * @since 1.5
+ */
public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
{
return getAnnotation(annotationClass) != null;