Class AnnotationInfoList

    • Field Detail

      • directlyRelatedAnnotations

        private AnnotationInfoList 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. See directOnly().
      • serialVersionUID

        private static final long serialVersionUID
        serialVersionUID
        See Also:
        Constant Field Values
    • Constructor Detail

      • AnnotationInfoList

        public AnnotationInfoList()
        Construct a new modifiable empty list of AnnotationInfo objects.
      • AnnotationInfoList

        public AnnotationInfoList​(int sizeHint)
        Construct a new modifiable empty list of AnnotationInfo objects, given a size hint.
        Parameters:
        sizeHint - the size hint
      • AnnotationInfoList

        public AnnotationInfoList​(AnnotationInfoList reachableAnnotations)
        Construct a new modifiable empty AnnotationInfoList, given an initial list of AnnotationInfo objects.
        Parameters:
        reachableAnnotations - the reachable annotations
      • AnnotationInfoList

        AnnotationInfoList​(AnnotationInfoList reachableAnnotations,
                           AnnotationInfoList directlyRelatedAnnotations)
        Constructor.
        Parameters:
        reachableAnnotations - the reachable annotations
        directlyRelatedAnnotations - the directly related annotations
    • Method Detail

      • findReferencedClassInfo

        protected void findReferencedClassInfo​(java.util.Map<java.lang.String,​ClassInfo> classNameToClassInfo,
                                               java.util.Set<ClassInfo> refdClassInfo,
                                               LogNode log)
        Get ClassInfo objects for any classes referenced in this list.
        Parameters:
        classNameToClassInfo - the map from class name to ClassInfo.
        refdClassInfo - the referenced class info
        log - the log
      • handleRepeatableAnnotations

        void handleRepeatableAnnotations​(java.util.Set<java.lang.String> allRepeatableAnnotationNames,
                                         ClassInfo containingClassInfo,
                                         ClassInfo.RelType forwardRelType,
                                         ClassInfo.RelType reverseRelType0,
                                         ClassInfo.RelType reverseRelType1)
        Handle Repeatable annotations.
        Parameters:
        allRepeatableAnnotationNames - the names of all repeatable annotations
        containingClassInfo - the containing class
        forwardRelType - 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,
                                                java.util.Set<ClassInfo> visited)
        Find the transitive closure of meta-annotations.
        Parameters:
        ai - the annotationInfo object
        allAnnotationsOut - annotations out
        visited - 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

        public AnnotationInfoList directOnly()
        returns the list of direct annotations, excluding meta-annotations. If this AnnotationInfoList 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.Class<? extends java.lang.annotation.Annotation> annotationClass)
        Get the Repeatable annotation 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

        public AnnotationInfoList getRepeatable​(java.lang.String name)
        Get the Repeatable 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.