Class JandexUtil

java.lang.Object
io.smallrye.openapi.runtime.util.JandexUtil

public class JandexUtil extends Object
Some utility methods for working with Jandex objects.
Author:
eric.wittmann@gmail.com
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    createUniqueMethodReference(org.jboss.jandex.ClassInfo classInfo, org.jboss.jandex.MethodInfo methodInfo)
     
    static boolean
    equals(org.jboss.jandex.AnnotationTarget t1, org.jboss.jandex.AnnotationTarget t2)
     
    static boolean
    equals(org.jboss.jandex.ClassInfo c1, org.jboss.jandex.ClassInfo c2)
     
    static boolean
    equals(org.jboss.jandex.FieldInfo f1, org.jboss.jandex.FieldInfo f2)
     
    static boolean
    equals(org.jboss.jandex.MethodParameterInfo p1, org.jboss.jandex.MethodParameterInfo p2)
     
    static List<org.jboss.jandex.FieldInfo>
    fields(AnnotationScannerContext context, org.jboss.jandex.ClassInfo currentClass)
     
    static boolean
    hasImplementation(org.jboss.jandex.AnnotationInstance annotation)
    Returns true if the given @Schema annotation has defined an "implementation" field.
    static boolean
    isArraySchema(AnnotationScannerContext context, org.jboss.jandex.AnnotationInstance annotation)
    Returns true if the given @Schema annotation is an array schema.
    static boolean
    isBooleanSchema(org.jboss.jandex.AnnotationInstance annotation)
    Returns true if the given @Schema annotation is a "boolean schema".
    static boolean
    isEmpty(org.jboss.jandex.AnnotationInstance annotation)
    Returns true if the given annotation is void of any values (and thus is "empty").
    static boolean
    isRef(org.jboss.jandex.AnnotationInstance annotation)
    Returns true if the given annotation instance is a "ref".
    static boolean
    isSimpleArraySchema(AnnotationScannerContext context, org.jboss.jandex.AnnotationInstance annotation)
    Returns true if the given @Schema annotation is a simple array schema.
    static boolean
    isSimpleClassSchema(org.jboss.jandex.AnnotationInstance annotation)
    Returns true if the given @Schema annotation is a simple class schema.
    static boolean
    isSupplier(org.jboss.jandex.AnnotationTarget target)
     
    static String
    nameFromRef(org.jboss.jandex.AnnotationInstance annotation)
    Gets the name of an item from its ref.
    static List<org.jboss.jandex.AnnotationValue>
    schemaDisplayValues(org.jboss.jandex.AnnotationInstance annotation)
     

    Methods inherited from class java.lang.Object

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

    • createUniqueMethodReference

      public static String createUniqueMethodReference(org.jboss.jandex.ClassInfo classInfo, org.jboss.jandex.MethodInfo methodInfo)
    • isRef

      public static boolean isRef(org.jboss.jandex.AnnotationInstance annotation)
      Returns true if the given annotation instance is a "ref". An annotation is a ref if it has a non-null value for the "ref" property.
      Parameters:
      annotation - AnnotationInstance
      Returns:
      Whether it's a "ref"
    • isEmpty

      public static boolean isEmpty(org.jboss.jandex.AnnotationInstance annotation)
      Returns true if the given annotation is void of any values (and thus is "empty"). An example of this would be if a jax-rs method were annotated with @Tag()
      Parameters:
      annotation - AnnotationInstance
      Returns:
      Whether it's empty
    • nameFromRef

      public static String nameFromRef(org.jboss.jandex.AnnotationInstance annotation)
      Gets the name of an item from its ref. For example, the ref might be "#/components/parameters/departureDate" which would result in a name of "departureDate".
      Parameters:
      annotation - AnnotationInstance
      Returns:
      Name of item from ref
    • schemaDisplayValues

      public static List<org.jboss.jandex.AnnotationValue> schemaDisplayValues(org.jboss.jandex.AnnotationInstance annotation)
    • isSimpleClassSchema

      public static boolean isSimpleClassSchema(org.jboss.jandex.AnnotationInstance annotation)
      Returns true if the given @Schema annotation is a simple class schema. This means that the annotation only has one field defined, and that field is "implementation".
      Parameters:
      annotation - AnnotationInstance
      Returns:
      Is it a simple class @Schema
    • isSimpleArraySchema

      public static boolean isSimpleArraySchema(AnnotationScannerContext context, org.jboss.jandex.AnnotationInstance annotation)
      Returns true if the given @Schema annotation is a simple array schema. This is defined as a schema with only a "type" field and "implementation" field defined *and* the type must be array.
      Parameters:
      annotation - AnnotationInstance
      Returns:
      Is it a simple array @Schema
    • isArraySchema

      public static boolean isArraySchema(AnnotationScannerContext context, org.jboss.jandex.AnnotationInstance annotation)
      Returns true if the given @Schema annotation is an array schema. This is defined as a schema with a "type" field and "implementation" field defined *and* the type must be array.
      Parameters:
      annotation - AnnotationInstance
      Returns:
      Is it an array @Schema
    • isBooleanSchema

      public static boolean isBooleanSchema(org.jboss.jandex.AnnotationInstance annotation)
      Returns true if the given @Schema annotation is a "boolean schema". This is defined as a schema with an implementation that is equal to either Schema.True or Schema.False.
      Parameters:
      annotation - schema annotation instance
      Returns:
      true if it has a boolean schema implementation, otherwise false.
    • hasImplementation

      public static boolean hasImplementation(org.jboss.jandex.AnnotationInstance annotation)
      Returns true if the given @Schema annotation has defined an "implementation" field.
      Parameters:
      annotation - AnnotationInstance
      Returns:
      true if the annotation defines an implementation, otherwise false
    • equals

      public static boolean equals(org.jboss.jandex.AnnotationTarget t1, org.jboss.jandex.AnnotationTarget t2)
    • equals

      public static boolean equals(org.jboss.jandex.ClassInfo c1, org.jboss.jandex.ClassInfo c2)
    • equals

      public static boolean equals(org.jboss.jandex.FieldInfo f1, org.jboss.jandex.FieldInfo f2)
    • equals

      public static boolean equals(org.jboss.jandex.MethodParameterInfo p1, org.jboss.jandex.MethodParameterInfo p2)
    • fields

      public static List<org.jboss.jandex.FieldInfo> fields(AnnotationScannerContext context, org.jboss.jandex.ClassInfo currentClass)
    • isSupplier

      public static boolean isSupplier(org.jboss.jandex.AnnotationTarget target)