Class AnnotationList.Empty
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<T>
-
- net.bytebuddy.matcher.FilterableList.Empty<AnnotationDescription,AnnotationList>
-
- net.bytebuddy.description.annotation.AnnotationList.Empty
-
- All Implemented Interfaces:
Iterable<AnnotationDescription>
,Collection<AnnotationDescription>
,List<AnnotationDescription>
,AnnotationList
,FilterableList<AnnotationDescription,AnnotationList>
- Enclosing interface:
- AnnotationList
public static class AnnotationList.Empty extends FilterableList.Empty<AnnotationDescription,AnnotationList> implements AnnotationList
Represents an empty 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>>
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description Empty()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static List<AnnotationList>
asList(int length)
Creates a list of empty annotation lists of the given dimension.TypeList
asTypeList()
Returns a list of the annotation types of this list.AnnotationList
inherited(Set<? extends TypeDescription> ignoredTypes)
Returns only annotations that are marked asInherited
as long as they are not contained by the set of ignored annotation types.boolean
isAnnotationPresent(Class<? extends Annotation> annotationType)
Checks if this list contains an annotation of the given type.boolean
isAnnotationPresent(TypeDescription annotationType)
Checks if this list contains an annotation of the given type.<T extends Annotation>
AnnotationDescription.Loadable<T>ofType(Class<T> annotationType)
Finds the first annotation of the given type and returns it.AnnotationDescription
ofType(TypeDescription annotationType)
Finds the first annotation of the given type and returns it.AnnotationList
visibility(ElementMatcher<? super RetentionPolicy> matcher)
Only retains annotations with the given retention policy.-
Methods inherited from class net.bytebuddy.matcher.FilterableList.Empty
filter, get, getOnly, size, subList
-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream
-
Methods inherited from interface net.bytebuddy.matcher.FilterableList
filter, getOnly, subList
-
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, toArray, toArray
-
-
-
-
Method Detail
-
asList
public static List<AnnotationList> asList(int length)
Creates a list of empty annotation lists of the given dimension.- Parameters:
length
- The length of the list.- Returns:
- A list of empty annotation lists of the given length.
-
isAnnotationPresent
public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
Checks if this list contains an annotation of the given type.- Specified by:
isAnnotationPresent
in interfaceAnnotationList
- Parameters:
annotationType
- The type to find in the list.- Returns:
true
if 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:
isAnnotationPresent
in interfaceAnnotationList
- Parameters:
annotationType
- The type to find in the list.- Returns:
true
if the list contains the annotation type.
-
ofType
public <T extends Annotation> AnnotationDescription.Loadable<T> ofType(Class<T> annotationType)
Finds the first annotation of the given type and returns it.- Specified by:
ofType
in interfaceAnnotationList
- Type Parameters:
T
- The annotation type.- Parameters:
annotationType
- The type to be found in the list.- Returns:
- The annotation description or
null
if no such annotation was found.
-
ofType
public AnnotationDescription ofType(TypeDescription annotationType)
Finds the first annotation of the given type and returns it.- Specified by:
ofType
in interfaceAnnotationList
- Parameters:
annotationType
- The type to be found in the list.- Returns:
- The annotation description or
null
if no such annotation was found.
-
inherited
public AnnotationList inherited(Set<? extends TypeDescription> ignoredTypes)
Returns only annotations that are marked asInherited
as long as they are not contained by the set of ignored annotation types.- Specified by:
inherited
in 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 RetentionPolicy> matcher)
Only retains annotations with the given retention policy.- Specified by:
visibility
in 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:
asTypeList
in interfaceAnnotationList
- Returns:
- A list of the annotation types of this list.
-
-