Top Description Methods
javax.enterprise.inject.spi

public Interface Annotated

Known Direct Subinterfaces
javax.enterprise.inject.spi.AnnotatedMember, javax.enterprise.inject.spi.AnnotatedParameter, javax.enterprise.inject.spi.AnnotatedType
Imports
java.lang.annotation.Annotation, java.lang.reflect.AnnotatedElement, .Type, java.util.Set

Represents a Java program element that can be annotated.

Authors
Gavin King, Pete Muir, Clint Popetz, John D. Ament
See Also
java.lang.reflect.AnnotatedElement

Method Summary

Modifier and TypeMethod and Description
public <
the type of the annotation
T extends Annotation
>
T

Returns:

the first program element annotation of the given annotation type, or a null value
getAnnotation
(Class<T>
the class of the annotation type
annotationType
)

Get program element annotation of a certain annotation type.

public <
the type of the annotation
T extends Annotation
>
Set<T>

Returns:

the program element annotations of the given annotation type, or an empty collection
getAnnotations
(Class<T>
the class of the annotation type
annotationType
)

Get program element annotations of a certain annotation type.

public Set<Annotation>

Returns:

all annotations of the program element, or an empty set if no annotations are present
getAnnotations
()

Get all annotations of the program element.

public Type

Returns:

the type of the annotated program element
getBaseType
()

Get the type of the annotated program element.

public Set<Type>

Returns:

a set of all types to which the base type should be considered assignable
getTypeClosure
()

Get all types to which the base type should be considered assignable.

public boolean

Returns:

true if the program element has an annotation of the given annotation type, or false otherwise
isAnnotationPresent
(Class<? extends Annotation>
the annotation type to check for
annotationType
)

Determine if the program element has an annotation of a certain annotation type.

Method Detail

getAnnotationback to summary
public <T extends Annotation> T getAnnotation(Class<T> annotationType)

Get program element annotation of a certain annotation type. The behavior of this method is intended to be the same behavior as AnnotatedElement#getAnnotation(Class), where repeatable annotations are not supported.

Parameters
<T>
the type of the annotation
annotationType:Class<T>

the class of the annotation type

Returns:T

the first program element annotation of the given annotation type, or a null value

getAnnotationsback to summary
public <T extends Annotation> Set<T> getAnnotations(Class<T> annotationType)

Get program element annotations of a certain annotation type.

This method returns back all annotations, including repeatable annotations of this type. The behavior of this method is intended to be the same behavior as AnnotatedElement#getAnnotationsByType(Class), where repeatable annotations are supported.

Parameters
<T>
the type of the annotation
annotationType:Class<T>

the class of the annotation type

Returns:Set<T>

the program element annotations of the given annotation type, or an empty collection

getAnnotationsback to summary
public Set<Annotation> getAnnotations()

Get all annotations of the program element.

Returns:Set<Annotation>

all annotations of the program element, or an empty set if no annotations are present

getBaseTypeback to summary
public Type getBaseType()

Get the type of the annotated program element.

Returns:Type

the type of the annotated program element

getTypeClosureback to summary
public Set<Type> getTypeClosure()

Get all types to which the base type should be considered assignable.

Returns:Set<Type>

a set of all types to which the base type should be considered assignable

isAnnotationPresentback to summary
public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)

Determine if the program element has an annotation of a certain annotation type. The behavior of this method is similar to AnnotatedElement#isAnnotationPresent(Class) for the underlying program element.

Parameters
annotationType:Class<? extends Annotation>

the annotation type to check for

Returns:boolean

true if the program element has an annotation of the given annotation type, or false otherwise