Class AnnotationInfoList
- All Implemented Interfaces:
Serializable, Cloneable, Iterable<AnnotationInfo>, Collection<AnnotationInfo>, List<AnnotationInfo>, RandomAccess, SequencedCollection<AnnotationInfo>
A list of
AnnotationInfo objects.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFilter anAnnotationInfoListusing a predicate mapping anAnnotationInfoobject to a boolean, producing anotherAnnotationInfoListfor all items in the list for which the predicate is true. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AnnotationInfoListThe set of annotations directly related to a class or method and not inherited through a meta-annotated annotation.(package private) static final AnnotationInfoListAn unmodifiable emptyAnnotationInfoList.private static final longserialVersionUIDFields inherited from class PotentiallyUnmodifiableList
modifiableFields inherited from class AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new modifiable empty list ofAnnotationInfoobjects.AnnotationInfoList(int sizeHint) Construct a new modifiable empty list ofAnnotationInfoobjects, given a size hint.AnnotationInfoList(AnnotationInfoList reachableAnnotations) Construct a new modifiable emptyAnnotationInfoList, given an initial list ofAnnotationInfoobjects.AnnotationInfoList(AnnotationInfoList reachableAnnotations, AnnotationInfoList directlyRelatedAnnotations) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionreturns the list of direct annotations, excluding meta-annotations.static AnnotationInfoListReturn an unmodifiable emptyAnnotationInfoList.booleanFind the subset of theAnnotationInfoobjects in this list for which the given filter predicate is true.private static voidfindMetaAnnotations(AnnotationInfo ai, AnnotationInfoList allAnnotationsOut, Set<ClassInfo> visited) Find the transitive closure of meta-annotations.protected voidfindReferencedClassInfo(Map<String, ClassInfo> classNameToClassInfo, Set<ClassInfo> refdClassInfo, LogNode log) GetClassInfoobjects for any classes referenced in this list.(package private) static AnnotationInfoListgetIndirectAnnotations(AnnotationInfoList directAnnotationInfo, ClassInfo annotatedClass) Get the indirect annotations on a class (meta-annotations and/or inherited annotations).getRepeatable(Class<? extends Annotation> annotationClass) Get theRepeatableannotation with the given class, or the empty list if none found.getRepeatable(String name) Get theRepeatableannotation with the given name, or the empty list if none found.(package private) voidhandleRepeatableAnnotations(Set<String> allRepeatableAnnotationNames, ClassInfo containingClassInfo, ClassInfo.RelType forwardRelType, ClassInfo.RelType reverseRelType0, ClassInfo.RelType reverseRelType1) HandleRepeatableannotations.inthashCode()Methods inherited from class MappableInfoList
asMap, containsName, getMethods inherited from class InfoList
getAsStrings, getAsStringsWithSimpleNames, getNamesMethods inherited from class PotentiallyUnmodifiableList
add, add, addAll, addAll, clear, iterator, listIterator, makeUnmodifiable, remove, remove, removeAll, retainAll, setMethods inherited from class ArrayList
addFirst, addLast, clone, contains, ensureCapacity, forEach, get, getFirst, getLast, indexOf, isEmpty, lastIndexOf, listIterator, removeFirst, removeIf, removeLast, removeRange, replaceAll, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class AbstractCollection
containsAll, toStringMethods inherited from interface Collection
parallelStream, stream, toArrayMethods inherited from interface List
containsAll, reversed
-
Field Details
-
directlyRelatedAnnotations
The set of annotations directly related to a class or method and not inherited through a meta-annotated annotation. This field is nullable, as the annotation info list is incrementally built. SeedirectOnly(). -
serialVersionUID
private static final long serialVersionUIDserialVersionUID- See Also:
-
EMPTY_LIST
An unmodifiable emptyAnnotationInfoList.
-
-
Constructor Details
-
AnnotationInfoList
public AnnotationInfoList()Construct a new modifiable empty list ofAnnotationInfoobjects. -
AnnotationInfoList
public AnnotationInfoList(int sizeHint) Construct a new modifiable empty list ofAnnotationInfoobjects, given a size hint.- Parameters:
sizeHint- the size hint
-
AnnotationInfoList
Construct a new modifiable emptyAnnotationInfoList, given an initial list ofAnnotationInfoobjects.- Parameters:
reachableAnnotations- the reachable annotations
-
AnnotationInfoList
AnnotationInfoList(AnnotationInfoList reachableAnnotations, AnnotationInfoList directlyRelatedAnnotations) Constructor.- Parameters:
reachableAnnotations- the reachable annotationsdirectlyRelatedAnnotations- the directly related annotations
-
-
Method Details
-
emptyList
Return an unmodifiable emptyAnnotationInfoList.- Returns:
- the unmodifiable empty
AnnotationInfoList.
-
filter
Find the subset of theAnnotationInfoobjects in this list for which the given filter predicate is true.- Parameters:
filter- TheAnnotationInfoList.AnnotationInfoFilterto apply.- Returns:
- The subset of the
AnnotationInfoobjects in this list for which the given filter predicate is true.
-
findReferencedClassInfo
protected void findReferencedClassInfo(Map<String, ClassInfo> classNameToClassInfo, Set<ClassInfo> refdClassInfo, LogNode log) GetClassInfoobjects for any classes referenced in this list.- Parameters:
classNameToClassInfo- the map from class name toClassInfo.refdClassInfo- the referenced class infolog- the log
-
handleRepeatableAnnotations
void handleRepeatableAnnotations(Set<String> allRepeatableAnnotationNames, ClassInfo containingClassInfo, ClassInfo.RelType forwardRelType, ClassInfo.RelType reverseRelType0, ClassInfo.RelType reverseRelType1) HandleRepeatableannotations.- Parameters:
allRepeatableAnnotationNames- the names of all repeatable annotationscontainingClassInfo- the containing classforwardRelType- the forward relationship type for linking (or null for none)reverseRelType0- the first reverse relationship type for linking (or null for none)reverseRelType1- the second reverse relationship type for linking (or null for none)
-
findMetaAnnotations
private static void findMetaAnnotations(AnnotationInfo ai, AnnotationInfoList allAnnotationsOut, Set<ClassInfo> visited) Find the transitive closure of meta-annotations.- Parameters:
ai- the annotationInfo objectallAnnotationsOut- annotations outvisited- visited
-
getIndirectAnnotations
static AnnotationInfoList getIndirectAnnotations(AnnotationInfoList directAnnotationInfo, ClassInfo annotatedClass) Get the indirect annotations on a class (meta-annotations and/or inherited annotations).- Parameters:
directAnnotationInfo- the direct annotations on the class, method, method parameter or field.annotatedClass- for class annotations, this is the annotated class, else null.- Returns:
- the indirect annotations
-
directOnly
returns the list of direct annotations, excluding meta-annotations. If thisAnnotationInfoListconsists 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
Get theRepeatableannotation with the given class, or the empty list if none found.- Parameters:
annotationClass- The class to search for.- Returns:
- The list of annotations with the given class, or the empty list if none found.
-
getRepeatable
Get theRepeatableannotation 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
- Specified by:
equalsin interfaceCollection<AnnotationInfo>- Specified by:
equalsin interfaceList<AnnotationInfo>- Overrides:
equalsin classInfoList<AnnotationInfo>
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<AnnotationInfo>- Specified by:
hashCodein interfaceList<AnnotationInfo>- Overrides:
hashCodein classInfoList<AnnotationInfo>
-