Package io.smallrye.openapi.runtime.util
Class JandexUtil
java.lang.Object
io.smallrye.openapi.runtime.util.JandexUtil
Some utility methods for working with Jandex objects.
- Author:
- eric.wittmann@gmail.com
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringcreateUniqueMethodReference(org.jboss.jandex.ClassInfo classInfo, org.jboss.jandex.MethodInfo methodInfo) static booleanequals(org.jboss.jandex.AnnotationTarget t1, org.jboss.jandex.AnnotationTarget t2) static booleanequals(org.jboss.jandex.ClassInfo c1, org.jboss.jandex.ClassInfo c2) static booleanequals(org.jboss.jandex.FieldInfo f1, org.jboss.jandex.FieldInfo f2) static booleanequals(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 booleanhasImplementation(org.jboss.jandex.AnnotationInstance annotation) Returns true if the given@Schemaannotation has defined an "implementation" field.static booleanisArraySchema(AnnotationScannerContext context, org.jboss.jandex.AnnotationInstance annotation) Returns true if the given@Schemaannotation is an array schema.static booleanisBooleanSchema(org.jboss.jandex.AnnotationInstance annotation) Returns true if the given@Schemaannotation is a "boolean schema".static booleanisEmpty(org.jboss.jandex.AnnotationInstance annotation) Returns true if the given annotation is void of any values (and thus is "empty").static booleanisRef(org.jboss.jandex.AnnotationInstance annotation) Returns true if the given annotation instance is a "ref".static booleanisSimpleArraySchema(AnnotationScannerContext context, org.jboss.jandex.AnnotationInstance annotation) Returns true if the given @Schema annotation is a simple array schema.static booleanisSimpleClassSchema(org.jboss.jandex.AnnotationInstance annotation) Returns true if the given @Schema annotation is a simple class schema.static booleanisSupplier(org.jboss.jandex.AnnotationTarget target) static StringnameFromRef(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)
-
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
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@Schemaannotation 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@Schemaannotation is a "boolean schema". This is defined as a schema with an implementation that is equal to eitherSchema.TrueorSchema.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@Schemaannotation 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)
-