java.lang.Object
org.jboss.resteasy.reactive.common.processor.JandexUtil

public final class JandexUtil extends Object
A collection of Jandex utility methods.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.jboss.jandex.DotName
     
    static final org.jboss.jandex.DotName
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.jboss.jandex.IndexView
     
    static org.jboss.jandex.IndexView
    createCalculatingIndex(org.jboss.jandex.IndexView index)
     
    static org.jboss.jandex.Index
     
    static org.jboss.jandex.ClassInfo
    getEnclosingClass(org.jboss.jandex.AnnotationInstance annotationInstance)
    Returns the enclosing class of the given annotation instance.
    static boolean
    isAssignableFrom(org.jboss.jandex.DotName superType, org.jboss.jandex.DotName subType, org.jboss.jandex.IndexView index)
     
    static boolean
    isImplementorOf(org.jboss.jandex.IndexView index, org.jboss.jandex.ClassInfo info, org.jboss.jandex.DotName name)
    Returns true if the given Jandex ClassInfo is a subclass of or inherits the given name.
    static boolean
    isImplementorOf(org.jboss.jandex.IndexView index, org.jboss.jandex.ClassInfo info, org.jboss.jandex.DotName name, Set<org.jboss.jandex.DotName> additionalIgnoredSuperClasses)
    Returns true if the given Jandex ClassInfo is a subclass of or inherits the given name.
    static boolean
    isSubclassOf(org.jboss.jandex.IndexView index, org.jboss.jandex.ClassInfo info, org.jboss.jandex.DotName parentName)
    Returns true if the given Jandex ClassInfo is a subclass of the given parentName.
    static List<org.jboss.jandex.Type>
    resolveTypeParameters(org.jboss.jandex.DotName input, org.jboss.jandex.DotName target, org.jboss.jandex.IndexView index)
    Returns the captured generic types of an interface given a class that at some point in the class hierarchy implements the interface.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DOTNAME_OBJECT

      public static final org.jboss.jandex.DotName DOTNAME_OBJECT
    • DOTNAME_RECORD

      public static final org.jboss.jandex.DotName DOTNAME_RECORD
  • Method Details

    • createIndex

      public static org.jboss.jandex.Index createIndex(Path path)
    • createCalculatingIndex

      public static org.jboss.jandex.IndexView createCalculatingIndex(Path path)
    • createCalculatingIndex

      public static org.jboss.jandex.IndexView createCalculatingIndex(org.jboss.jandex.IndexView index)
    • resolveTypeParameters

      public static List<org.jboss.jandex.Type> resolveTypeParameters(org.jboss.jandex.DotName input, org.jboss.jandex.DotName target, org.jboss.jandex.IndexView index)
      Returns the captured generic types of an interface given a class that at some point in the class hierarchy implements the interface. The list contains the types in the same order as they are generic parameters defined on the interface A result is only returned if and only if all the generics where captured. If any of them where not defined by the class an exception is thrown. Also note that all parts of the class/interface hierarchy must be in the supplied index As an example, imagine the following class:
      
       class MyList implements List<String> {
           ...
       }
      
       
      If we call
      
       JandexUtil.resolveTypeParameters(DotName.createSimple(MyList.class.getName()),
               DotName.createSimple(List.class.getName()), index)
      
       
      then the result will contain a single element of class ClassType whose name() would return a DotName for String
    • getEnclosingClass

      public static org.jboss.jandex.ClassInfo getEnclosingClass(org.jboss.jandex.AnnotationInstance annotationInstance)
      Returns the enclosing class of the given annotation instance. For field, method or record component annotations, this will return the enclosing class. For parameters, this will return the enclosing class of the enclosing method. For classes, it will return the class itself. For type annotations, it will return the class enclosing the annotated type usage.
      Parameters:
      annotationInstance - the annotation whose enclosing class to look up
      Returns:
      the enclosing class
    • isSubclassOf

      public static boolean isSubclassOf(org.jboss.jandex.IndexView index, org.jboss.jandex.ClassInfo info, org.jboss.jandex.DotName parentName)
      Returns true if the given Jandex ClassInfo is a subclass of the given parentName. Note that this will not check interfaces.
      Parameters:
      index - the index to use to look up super classes.
      info - the ClassInfo we want to check.
      parentName - the name of the superclass we want to find.
      Returns:
      true if the given ClassInfo has parentName as a superclass.
      Throws:
      RuntimeException - if one of the superclasses is not indexed.
    • isImplementorOf

      public static boolean isImplementorOf(org.jboss.jandex.IndexView index, org.jboss.jandex.ClassInfo info, org.jboss.jandex.DotName name)
      Returns true if the given Jandex ClassInfo is a subclass of or inherits the given name.
      Parameters:
      index - the index to use to look up super classes.
      info - the ClassInfo we want to check.
      name - the name of the superclass or interface we want to find.
      Throws:
      RuntimeException - if one of the superclasses is not indexed.
    • isImplementorOf

      public static boolean isImplementorOf(org.jboss.jandex.IndexView index, org.jboss.jandex.ClassInfo info, org.jboss.jandex.DotName name, Set<org.jboss.jandex.DotName> additionalIgnoredSuperClasses)
      Returns true if the given Jandex ClassInfo is a subclass of or inherits the given name.
      Parameters:
      index - the index to use to look up super classes.
      info - the ClassInfo we want to check.
      name - the name of the superclass or interface we want to find.
      additionalIgnoredSuperClasses - return false if the class has any of these as a superclass.
      Throws:
      RuntimeException - if one of the superclasses is not indexed.
    • isAssignableFrom

      public static boolean isAssignableFrom(org.jboss.jandex.DotName superType, org.jboss.jandex.DotName subType, org.jboss.jandex.IndexView index)