Package io.github.classgraph
Class AnnotationInfoList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<T>
-
- io.github.classgraph.InfoList<T>
-
- io.github.classgraph.MappableInfoList<AnnotationInfo>
-
- io.github.classgraph.AnnotationInfoList
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<AnnotationInfo>
,java.util.Collection<AnnotationInfo>
,java.util.List<AnnotationInfo>
,java.util.RandomAccess
public class AnnotationInfoList extends MappableInfoList<AnnotationInfo>
A list ofAnnotationInfo
objects.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AnnotationInfoList.AnnotationInfoFilter
Filter anAnnotationInfoList
using a predicate mapping anAnnotationInfo
object to a boolean, producing anotherAnnotationInfoList
for all items in the list for which the predicate is true.
-
Constructor Summary
Constructors Constructor Description AnnotationInfoList()
Construct a new modifiable empty list ofAnnotationInfo
objects.AnnotationInfoList(int sizeHint)
Construct a new modifiable empty list ofAnnotationInfo
objects, given a size hint.AnnotationInfoList(AnnotationInfoList reachableAnnotations)
Construct a new modifiable emptyAnnotationInfoList
, given an initial list ofAnnotationInfo
objects.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, T element)
boolean
add(T element)
boolean
addAll(int index, java.util.Collection<? extends T> c)
boolean
addAll(java.util.Collection<? extends T> c)
void
clear()
AnnotationInfoList
directOnly()
returns the list of direct annotations, excluding meta-annotations.static AnnotationInfoList
emptyList()
Return an unmodifiable emptyAnnotationInfoList
.boolean
equals(java.lang.Object obj)
AnnotationInfoList
filter(AnnotationInfoList.AnnotationInfoFilter filter)
Find the subset of theAnnotationInfo
objects in this list for which the given filter predicate is true.protected void
findReferencedClassInfo(java.util.Map<java.lang.String,ClassInfo> classNameToClassInfo, java.util.Set<ClassInfo> refdClassInfo)
GetClassInfo
objects for any classes referenced in this list.AnnotationInfoList
getRepeatable(java.lang.String name)
Get theRepeatable
annotation with the given name, or the empty list if none found.int
hashCode()
java.util.Iterator<T>
iterator()
java.util.ListIterator<T>
listIterator()
T
remove(int index)
boolean
remove(java.lang.Object o)
boolean
removeAll(java.util.Collection<?> c)
boolean
retainAll(java.util.Collection<?> c)
T
set(int index, T element)
-
Methods inherited from class io.github.classgraph.MappableInfoList
asMap, containsName, get
-
Methods inherited from class io.github.classgraph.InfoList
getAsStrings, getNames
-
Methods inherited from class java.util.ArrayList
clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, lastIndexOf, listIterator, removeIf, removeRange, replaceAll, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
-
-
-
Constructor Detail
-
AnnotationInfoList
public AnnotationInfoList()
Construct a new modifiable empty list ofAnnotationInfo
objects.
-
AnnotationInfoList
public AnnotationInfoList(int sizeHint)
Construct a new modifiable empty list ofAnnotationInfo
objects, given a size hint.- Parameters:
sizeHint
- the size hint
-
AnnotationInfoList
public AnnotationInfoList(AnnotationInfoList reachableAnnotations)
Construct a new modifiable emptyAnnotationInfoList
, given an initial list ofAnnotationInfo
objects.- Parameters:
reachableAnnotations
- the reachable annotations
-
-
Method Detail
-
emptyList
public static AnnotationInfoList emptyList()
Return an unmodifiable emptyAnnotationInfoList
.- Returns:
- the unmodifiable empty
AnnotationInfoList
.
-
filter
public AnnotationInfoList filter(AnnotationInfoList.AnnotationInfoFilter filter)
Find the subset of theAnnotationInfo
objects in this list for which the given filter predicate is true.- Parameters:
filter
- TheAnnotationInfoList.AnnotationInfoFilter
to apply.- Returns:
- The subset of the
AnnotationInfo
objects in this list for which the given filter predicate is true.
-
findReferencedClassInfo
protected void findReferencedClassInfo(java.util.Map<java.lang.String,ClassInfo> classNameToClassInfo, java.util.Set<ClassInfo> refdClassInfo)
GetClassInfo
objects for any classes referenced in this list.- Parameters:
classNameToClassInfo
- the map from class name toClassInfo
.refdClassInfo
- the referenced class info
-
directOnly
public AnnotationInfoList directOnly()
returns the list of direct annotations, excluding meta-annotations. If thisAnnotationInfoList
consists of class annotations, i.e. if it was produced using `ClassInfo#getAnnotationInfo()`, then the returned list also excludes annotations inherited from a superclass or implemented interface that was meta-annotated with@Inherited
.- Returns:
- The list of directly-related annotations.
-
getRepeatable
public AnnotationInfoList getRepeatable(java.lang.String name)
Get theRepeatable
annotation with the given name, or the empty list if none found.- Parameters:
name
- The name to search for.- Returns:
- The list of annotations with the given name, or the empty list if none found.
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equals
in interfacejava.util.Collection<AnnotationInfo>
- Specified by:
equals
in interfacejava.util.List<AnnotationInfo>
- Overrides:
equals
in classInfoList<AnnotationInfo>
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfacejava.util.Collection<AnnotationInfo>
- Specified by:
hashCode
in interfacejava.util.List<AnnotationInfo>
- Overrides:
hashCode
in classInfoList<AnnotationInfo>
-
add
public boolean add(T element)
- Specified by:
add
in interfacejava.util.Collection<T>
- Specified by:
add
in interfacejava.util.List<T>
- Overrides:
add
in classjava.util.ArrayList<T>
-
add
public void add(int index, T element)
- Specified by:
add
in interfacejava.util.List<T>
- Overrides:
add
in classjava.util.ArrayList<T>
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
remove
in interfacejava.util.Collection<T>
- Specified by:
remove
in interfacejava.util.List<T>
- Overrides:
remove
in classjava.util.ArrayList<T>
-
remove
public T remove(int index)
- Specified by:
remove
in interfacejava.util.List<T>
- Overrides:
remove
in classjava.util.ArrayList<T>
-
addAll
public boolean addAll(java.util.Collection<? extends T> c)
- Specified by:
addAll
in interfacejava.util.Collection<T>
- Specified by:
addAll
in interfacejava.util.List<T>
- Overrides:
addAll
in classjava.util.ArrayList<T>
-
addAll
public boolean addAll(int index, java.util.Collection<? extends T> c)
- Specified by:
addAll
in interfacejava.util.List<T>
- Overrides:
addAll
in classjava.util.ArrayList<T>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAll
in interfacejava.util.Collection<T>
- Specified by:
removeAll
in interfacejava.util.List<T>
- Overrides:
removeAll
in classjava.util.ArrayList<T>
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAll
in interfacejava.util.Collection<T>
- Specified by:
retainAll
in interfacejava.util.List<T>
- Overrides:
retainAll
in classjava.util.ArrayList<T>
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Collection<T>
- Specified by:
clear
in interfacejava.util.List<T>
- Overrides:
clear
in classjava.util.ArrayList<T>
-
set
public T set(int index, T element)
- Specified by:
set
in interfacejava.util.List<T>
- Overrides:
set
in classjava.util.ArrayList<T>
-
iterator
public java.util.Iterator<T> iterator()
- Specified by:
iterator
in interfacejava.util.Collection<T>
- Specified by:
iterator
in interfacejava.lang.Iterable<T>
- Specified by:
iterator
in interfacejava.util.List<T>
- Overrides:
iterator
in classjava.util.ArrayList<T>
-
listIterator
public java.util.ListIterator<T> listIterator()
- Specified by:
listIterator
in interfacejava.util.List<T>
- Overrides:
listIterator
in classjava.util.ArrayList<T>
-
-