Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public interface

AnnotatedElement

java.lang.reflect.AnnotatedElement
Known Indirect Subclasses

Class Overview

This interface provides reflective access to annotation information.

Summary

Public Methods
abstract <T extends  Annotation > T )">getAnnotation ( Class <T> annotationType)
Returns, for this element, the annotation with the specified type, or null if no annotation with the specified type is present (including inherited annotations).
abstract Annotation[] getAnnotations ()
Returns, for this element, an array containing all annotations (including inherited annotations).
abstract Annotation[] getDeclaredAnnotations ()
Returns, for this element, all annotations that are explicitly declared (not inherited).
abstract boolean )">isAnnotationPresent ( Class <? extends  Annotation > annotationType)
Indicates whether or not this element has an annotation with the specified annotation type (including inherited annotations).

Public Methods

)">

public abstract T getAnnotation ( Class <T> annotationType)

Added in API level 1

Returns, for this element, the annotation with the specified type, or null if no annotation with the specified type is present (including inherited annotations).

Parameters
annotationType the type of the annotation to search for
Returns
  • the annotation with the specified type or null
Throws
NullPointerException if annotationType is null

public abstract Annotation[] getAnnotations ()

Added in API level 1

Returns, for this element, an array containing all annotations (including inherited annotations). If there are no annotations present, this method returns a zero length array.

Returns
  • an array of all annotations for this element

public abstract Annotation[] getDeclaredAnnotations ()

Added in API level 1

Returns, for this element, all annotations that are explicitly declared (not inherited). If there are no declared annotations present, this method returns a zero length array.

Returns
  • an array of annotations declared for this element
)">

public abstract boolean isAnnotationPresent ( Class <? extends  Annotation > annotationType)

Added in API level 1

Indicates whether or not this element has an annotation with the specified annotation type (including inherited annotations).

Parameters
annotationType the type of the annotation to search for
Returns
  • true if the annotation exists, false otherwise
Throws
NullPointerException if annotationType is null