Interface AnnotationList
-
- All Superinterfaces:
java.util.Collection<AnnotationDescription>,FilterableList<AnnotationDescription,AnnotationList>,java.lang.Iterable<AnnotationDescription>,java.util.List<AnnotationDescription>
- All Known Implementing Classes:
AnnotationList.AbstractBase,AnnotationList.Empty,AnnotationList.Explicit,AnnotationList.ForLoadedAnnotations
public interface AnnotationList extends FilterableList<AnnotationDescription,AnnotationList>
Defines a list of annotation instances.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classAnnotationList.AbstractBaseAn abstract base implementation of an annotation list.static classAnnotationList.EmptyRepresents an empty annotation list.static classAnnotationList.ExplicitRepresents a list of explicitly provided annotation descriptions.static classAnnotationList.ForLoadedAnnotationsDescribes an array of loadedAnnotations as an annotation list.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TypeListasTypeList()Returns a list of the annotation types of this list.AnnotationListinherited(java.util.Set<? extends TypeDescription> ignoredTypes)Returns only annotations that are marked asInheritedas long as they are not contained by the set of ignored annotation types.booleanisAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)Checks if this list contains an annotation of the given type.booleanisAnnotationPresent(TypeDescription annotationType)Checks if this list contains an annotation of the given type.<T extends java.lang.annotation.Annotation>
AnnotationDescription.Loadable<T>ofType(java.lang.Class<T> annotationType)Finds the first annotation of the given type and returns it.AnnotationDescriptionofType(TypeDescription annotationType)Finds the first annotation of the given type and returns it.AnnotationListvisibility(ElementMatcher<? super java.lang.annotation.RetentionPolicy> matcher)Only retains annotations with the given retention policy.-
Methods inherited from interface net.bytebuddy.matcher.FilterableList
filter, getOnly, subList
-
-
-
-
Method Detail
-
isAnnotationPresent
boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Checks if this list contains an annotation of the given type.- Parameters:
annotationType- The type to find in the list.- Returns:
trueif the list contains the annotation type.
-
isAnnotationPresent
boolean isAnnotationPresent(TypeDescription annotationType)
Checks if this list contains an annotation of the given type.- Parameters:
annotationType- The type to find in the list.- Returns:
trueif the list contains the annotation type.
-
ofType
<T extends java.lang.annotation.Annotation> AnnotationDescription.Loadable<T> ofType(java.lang.Class<T> annotationType)
Finds the first annotation of the given type and returns it.- Type Parameters:
T- The annotation type.- Parameters:
annotationType- The type to be found in the list.- Returns:
- The annotation description or
nullif no such annotation was found.
-
ofType
AnnotationDescription ofType(TypeDescription annotationType)
Finds the first annotation of the given type and returns it.- Parameters:
annotationType- The type to be found in the list.- Returns:
- The annotation description or
nullif no such annotation was found.
-
inherited
AnnotationList inherited(java.util.Set<? extends TypeDescription> ignoredTypes)
Returns only annotations that are marked asInheritedas long as they are not contained by the set of ignored annotation types.- Parameters:
ignoredTypes- A list of annotation types to be ignored from the lookup.- Returns:
- A list of all inherited annotations besides of the given ignored types.
-
visibility
AnnotationList visibility(ElementMatcher<? super java.lang.annotation.RetentionPolicy> matcher)
Only retains annotations with the given retention policy.- Parameters:
matcher- A matcher for the required retention policy.- Returns:
- A of annotations only with elements
-
asTypeList
TypeList asTypeList()
Returns a list of the annotation types of this list.- Returns:
- A list of the annotation types of this list.
-
-