Class AnnotationList.AbstractBase
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<T>
-
- net.bytebuddy.matcher.FilterableList.AbstractBase<AnnotationDescription,AnnotationList>
-
- net.bytebuddy.description.annotation.AnnotationList.AbstractBase
-
- All Implemented Interfaces:
java.lang.Iterable<AnnotationDescription>,java.util.Collection<AnnotationDescription>,java.util.List<AnnotationDescription>,AnnotationList,FilterableList<AnnotationDescription,AnnotationList>
- Direct Known Subclasses:
AnnotationList.Explicit,AnnotationList.ForLoadedAnnotations
- Enclosing interface:
- AnnotationList
public abstract static class AnnotationList.AbstractBase extends FilterableList.AbstractBase<AnnotationDescription,AnnotationList> implements AnnotationList
An abstract base implementation of an annotation list.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.annotation.AnnotationList
AnnotationList.AbstractBase, AnnotationList.Empty, AnnotationList.Explicit, AnnotationList.ForLoadedAnnotations
-
Nested classes/interfaces inherited from interface net.bytebuddy.matcher.FilterableList
FilterableList.AbstractBase<T,S extends FilterableList<T,S>>, FilterableList.Empty<T,S extends FilterableList<T,S>>
-
-
Constructor Summary
Constructors Constructor Description AbstractBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TypeListasTypeList()Returns a list of the annotation types of this list.java.util.List<java.lang.String>asTypeNames()Returns a list of the names of the annotation types.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.protected AnnotationListwrap(java.util.List<AnnotationDescription> values)Represents a list of values as an instance of this instance's list type.-
Methods inherited from class net.bytebuddy.matcher.FilterableList.AbstractBase
filter, getOnly, subList
-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, get, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, size, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.bytebuddy.matcher.FilterableList
filter, getOnly, subList
-
-
-
-
Method Detail
-
isAnnotationPresent
public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Checks if this list contains an annotation of the given type.- Specified by:
isAnnotationPresentin interfaceAnnotationList- Parameters:
annotationType- The type to find in the list.- Returns:
trueif the list contains the annotation type.
-
isAnnotationPresent
public boolean isAnnotationPresent(TypeDescription annotationType)
Checks if this list contains an annotation of the given type.- Specified by:
isAnnotationPresentin interfaceAnnotationList- Parameters:
annotationType- The type to find in the list.- Returns:
trueif the list contains the annotation type.
-
ofType
@MaybeNull public <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.- Specified by:
ofTypein interfaceAnnotationList- 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
@MaybeNull public AnnotationDescription ofType(TypeDescription annotationType)
Finds the first annotation of the given type and returns it.- Specified by:
ofTypein interfaceAnnotationList- Parameters:
annotationType- The type to be found in the list.- Returns:
- The annotation description or
nullif no such annotation was found.
-
inherited
public 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.- Specified by:
inheritedin interfaceAnnotationList- 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
public AnnotationList visibility(ElementMatcher<? super java.lang.annotation.RetentionPolicy> matcher)
Only retains annotations with the given retention policy.- Specified by:
visibilityin interfaceAnnotationList- Parameters:
matcher- A matcher for the required retention policy.- Returns:
- A of annotations only with elements
-
asTypeList
public TypeList asTypeList()
Returns a list of the annotation types of this list.- Specified by:
asTypeListin interfaceAnnotationList- Returns:
- A list of the annotation types of this list.
-
asTypeNames
public java.util.List<java.lang.String> asTypeNames()
Returns a list of the names of the annotation types. This list might contain the names of annotations that are not otherwise resolvable.- Specified by:
asTypeNamesin interfaceAnnotationList- Returns:
- A list of binary names of the represented annotations.
-
wrap
protected AnnotationList wrap(java.util.List<AnnotationDescription> values)
Description copied from class:FilterableList.AbstractBaseRepresents a list of values as an instance of this instance's list type.- Specified by:
wrapin classFilterableList.AbstractBase<AnnotationDescription,AnnotationList>- Parameters:
values- The values to wrap in an instance of this list's type.- Returns:
- A wrapped instance of the given
values.
-
-