English | Site Directory

Android - An Open Handset Alliance Project

java.lang.reflect
public interface

java.lang.reflect.AnnotatedElement

java.lang.reflect.AnnotatedElement

An interface implemented an annotated element to enable reflective access to annotation information.

Known Indirect Subclasses

Summary

Public Methods

        T  getAnnotation(Class annotationType)
Gets the Annotation for this element for the annotation type passed, if it exists.
        Annotation[]  getAnnotations()
Gets all Annotations for this element.
        Annotation[]  getDeclaredAnnotations()
Gets all Annotations that are explicitly declared by this element (not inherited).
        boolean  isAnnotationPresent(Class annotationType)
Determines if this element has an annotation for the annotation type passed.

Details

Public Methods

public T getAnnotation(Class annotationType)

Gets the Annotation for this element for the annotation type passed, if it exists.

Parameters

annotationType The Class instance of the annotation to search for.

Returns

Throws

NullPointerException if annotationType is null.

public Annotation[] getAnnotations()

Gets all Annotations for this element.

Returns

  • An array of Annotations, which may be empty, but never null.

public Annotation[] getDeclaredAnnotations()

Gets all Annotations that are explicitly declared by this element (not inherited).

Returns

  • An array of Annotations, which may be empty, but never null.

public boolean isAnnotationPresent(Class annotationType)

Determines if this element has an annotation for the annotation type passed.

Parameters

annotationType The class instance of the annotation to search for.

Returns

  • true if the annotation exists, otherwise false.

Throws

NullPointerException if annotationType is null.
Build m5-rc15g - 14 May 2008 12:50