Package com.google.gwt.core.ext.typeinfo
Interface HasAnnotations
- All Known Subinterfaces:
JAbstractMethod
,JAnnotationMethod
,JAnnotationType
,JArrayType
,JClassType
,JConstructor
,JEnumConstant
,JEnumType
,JField
,JGenericType
,JMethod
,JPackage
,JParameter
,JParameterizedType
,JRawType
,JRealClassType
,JTypeParameter
,JWildcardType
public interface HasAnnotations
Interface implemented by elements that can have annotations. This interface
is a departure for GWT in that it used types declared in the
java.lang.annotation package instead of types declared as part of this
typeinfo package. This reflects a compromise between a pure
TypeOracle
model and one that is more useful to developers.-
Method Summary
Modifier and TypeMethodDescription<T extends Annotation>
TgetAnnotation
(Class<T> annotationClass) Returns an instance of the specified annotation type if it is present on this element ornull
if it is not.Returns all the annotations present on this element.Returns the annotations declared directly on this element; does not include any inherited annotations.boolean
isAnnotationPresent
(Class<? extends Annotation> annotationClass) Returnstrue
if this item has an annotation of the specified type.
-
Method Details
-
getAnnotation
Returns an instance of the specified annotation type if it is present on this element ornull
if it is not. For a class, this will look for annotations on supertypes as well.- Parameters:
annotationClass
- annotation type to search for- Returns:
- instance of the specified annotation type if it is present on this
element or
null
if it is not
-
getAnnotations
Annotation[] getAnnotations()Returns all the annotations present on this element. For a class, the list will include annotations on supertypes as well. -
getDeclaredAnnotations
Annotation[] getDeclaredAnnotations()Returns the annotations declared directly on this element; does not include any inherited annotations. -
isAnnotationPresent
Returnstrue
if this item has an annotation of the specified type. For a class, this will look at supertypes as well.- Returns:
true
if this item has an annotation of the specified type
-