Class Annotations


  • public final class Annotations
    extends Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean contains​(Collection<org.jboss.jandex.AnnotationInstance> annotations, org.jboss.jandex.DotName name)  
      static boolean containsAny​(Collection<org.jboss.jandex.AnnotationInstance> annotations, Iterable<org.jboss.jandex.DotName> names)  
      static org.jboss.jandex.AnnotationInstance find​(Collection<org.jboss.jandex.AnnotationInstance> annotations, org.jboss.jandex.DotName name)  
      static Set<org.jboss.jandex.AnnotationInstance> getAnnotations​(org.jboss.jandex.AnnotationTarget.Kind kind, Collection<org.jboss.jandex.AnnotationInstance> annotations)  
      static Set<org.jboss.jandex.AnnotationInstance> getAnnotations​(org.jboss.jandex.AnnotationTarget.Kind kind, org.jboss.jandex.DotName name, Collection<org.jboss.jandex.AnnotationInstance> annotations)  
      static org.jboss.jandex.AnnotationInstance getParameterAnnotation​(org.jboss.jandex.MethodInfo method, org.jboss.jandex.DotName annotation)
      Iterates over all annotations on a method and its parameters, filters out all non-parameter annotations and returns a first encountered AnnotationInstance with Annotation specified as DotName.
      static Set<org.jboss.jandex.AnnotationInstance> getParameterAnnotations​(BeanDeployment beanDeployment, org.jboss.jandex.MethodInfo method)  
      static Set<org.jboss.jandex.AnnotationInstance> getParameterAnnotations​(BeanDeployment beanDeployment, org.jboss.jandex.MethodInfo method, int position)  
      static Set<org.jboss.jandex.AnnotationInstance> getParameterAnnotations​(Collection<org.jboss.jandex.AnnotationInstance> annotations)  
      static Set<org.jboss.jandex.AnnotationInstance> getParameterAnnotations​(Function<org.jboss.jandex.AnnotationTarget,​Collection<org.jboss.jandex.AnnotationInstance>> transformedAnnotations, org.jboss.jandex.MethodInfo method, int position)  
    • Method Detail

      • find

        public static org.jboss.jandex.AnnotationInstance find​(Collection<org.jboss.jandex.AnnotationInstance> annotations,
                                                               org.jboss.jandex.DotName name)
        Parameters:
        annotations -
        name -
        Returns:
        the first matching annotation instance with the given name or null
      • contains

        public static boolean contains​(Collection<org.jboss.jandex.AnnotationInstance> annotations,
                                       org.jboss.jandex.DotName name)
        Parameters:
        annotations -
        name -
        Returns:
        true if the given collection contains an annotation instance with the given name, false otherwise
      • containsAny

        public static boolean containsAny​(Collection<org.jboss.jandex.AnnotationInstance> annotations,
                                          Iterable<org.jboss.jandex.DotName> names)
        Parameters:
        annotations -
        names -
        Returns:
        true if the given collection contains an annotation instance with any of the given names, false otherwise
      • getParameterAnnotations

        public static Set<org.jboss.jandex.AnnotationInstance> getParameterAnnotations​(Collection<org.jboss.jandex.AnnotationInstance> annotations)
        Parameters:
        annotations -
        Returns:
        the parameter annotations
      • getAnnotations

        public static Set<org.jboss.jandex.AnnotationInstance> getAnnotations​(org.jboss.jandex.AnnotationTarget.Kind kind,
                                                                              Collection<org.jboss.jandex.AnnotationInstance> annotations)
        Parameters:
        annotations -
        Returns:
        the annotations for the given kind
      • getAnnotations

        public static Set<org.jboss.jandex.AnnotationInstance> getAnnotations​(org.jboss.jandex.AnnotationTarget.Kind kind,
                                                                              org.jboss.jandex.DotName name,
                                                                              Collection<org.jboss.jandex.AnnotationInstance> annotations)
        Parameters:
        annotations -
        Returns:
        the annotations for the given kind and name
      • getParameterAnnotations

        public static Set<org.jboss.jandex.AnnotationInstance> getParameterAnnotations​(BeanDeployment beanDeployment,
                                                                                       org.jboss.jandex.MethodInfo method)
        Parameters:
        beanDeployment -
        method -
        Returns:
        collection of annotations present on all parameters of given method
      • getParameterAnnotations

        public static Set<org.jboss.jandex.AnnotationInstance> getParameterAnnotations​(BeanDeployment beanDeployment,
                                                                                       org.jboss.jandex.MethodInfo method,
                                                                                       int position)
        Parameters:
        beanDeployment -
        method -
        position -
        Returns:
        the parameter annotations for the given position
      • getParameterAnnotations

        public static Set<org.jboss.jandex.AnnotationInstance> getParameterAnnotations​(Function<org.jboss.jandex.AnnotationTarget,​Collection<org.jboss.jandex.AnnotationInstance>> transformedAnnotations,
                                                                                       org.jboss.jandex.MethodInfo method,
                                                                                       int position)
        Parameters:
        transformedAnnotations -
        method -
        position -
        Returns:
        the parameter annotations for the given position
      • getParameterAnnotation

        public static org.jboss.jandex.AnnotationInstance getParameterAnnotation​(org.jboss.jandex.MethodInfo method,
                                                                                 org.jboss.jandex.DotName annotation)
        Iterates over all annotations on a method and its parameters, filters out all non-parameter annotations and returns a first encountered AnnotationInstance with Annotation specified as DotName. Returns null if no such annotation exists.
        Parameters:
        method - MethodInfo to be searched for annotations
        annotation - Annotation we are looking for, represented as DotName
        Returns:
        First encountered AnnotationInstance fitting the requirements, null if none is found