public class JandexUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
JandexUtil.RefType
Simple enum to indicate the type of a $ref being read/written.
|
| Modifier and Type | Method and Description |
|---|---|
static Optional<Boolean> |
booleanValue(org.jboss.jandex.AnnotationInstance annotation,
String propertyName)
Reads a Boolean property value from the given annotation instance.
|
static boolean |
booleanValueWithDefault(org.jboss.jandex.AnnotationInstance annotation,
String propertyName)
Reads a Boolean property from the given annotation instance.
|
static <T extends Enum<?>> |
enumValue(org.jboss.jandex.AnnotationInstance annotation,
String propertyName,
Class<T> clazz)
Reads a String property value from the given annotation instance.
|
static <T extends Enum<?>> |
enumValue(String strVal,
Class<T> clazz)
Converts a string value to the given enum type.
|
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 org.jboss.jandex.AnnotationInstance |
getClassAnnotation(org.jboss.jandex.ClassInfo ct,
org.jboss.jandex.DotName name)
Gets a single class annotation from the given class.
|
static org.jboss.jandex.AnnotationInstance |
getMethodParameterAnnotation(org.jboss.jandex.MethodInfo method,
int parameterIndex,
org.jboss.jandex.DotName annotationName)
Finds an annotation (if present) with the given name, on a particular parameter of a
method.Returns null if not found.
|
static org.jboss.jandex.Type |
getMethodParameterType(org.jboss.jandex.MethodInfo method,
short position)
Returns the class type of the method parameter at the given position.
|
static org.jboss.jandex.Type |
getMethodParameterType(org.jboss.jandex.MethodParameterInfo parameter)
Returns the class type of the method parameter.
|
static List<org.jboss.jandex.AnnotationInstance> |
getParameterAnnotations(org.jboss.jandex.MethodInfo method,
short paramPosition)
Returns all annotations configured for a single parameter of a method.
|
static List<org.jboss.jandex.AnnotationInstance> |
getRepeatableAnnotation(org.jboss.jandex.AnnotationTarget target,
org.jboss.jandex.DotName singleAnnotationName,
org.jboss.jandex.DotName repeatableAnnotationName)
Many OAI annotations can either be found singly or as a wrapped array.
|
static boolean |
hasImplementation(org.jboss.jandex.AnnotationInstance annotation)
Returns true if the given
@Schema
annotation has defined an "implementation" field. |
static Map<org.jboss.jandex.ClassInfo,org.jboss.jandex.Type> |
inheritanceChain(org.jboss.jandex.IndexView index,
org.jboss.jandex.ClassInfo klazz,
org.jboss.jandex.Type type)
Builds an insertion-order map of a class's inheritance chain, starting
with the klazz argument.
|
static Integer |
intValue(org.jboss.jandex.AnnotationInstance annotation,
String propertyName)
Reads a Integer property value from the given annotation instance.
|
static boolean |
isArraySchema(org.jboss.jandex.AnnotationInstance annotation)
Returns true if the given
@Schema
annotation is an array 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(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 String |
nameFromRef(org.jboss.jandex.AnnotationInstance annotation)
Gets the name of an item from its ref.
|
static Optional<String> |
optionalStringValue(org.jboss.jandex.AnnotationInstance annotation,
String propertyName) |
static String |
refValue(org.jboss.jandex.AnnotationInstance annotation,
JandexUtil.RefType refType)
Reads a string property named "ref" value from the given annotation and converts it
to a value appropriate for setting on a model's "$ref" property.
|
static List<org.jboss.jandex.AnnotationValue> |
schemaDisplayValues(org.jboss.jandex.AnnotationInstance annotation) |
static Optional<List<String>> |
stringListValue(org.jboss.jandex.AnnotationInstance annotation,
String propertyName)
Reads a String array property value from the given annotation instance.
|
static String |
stringValue(org.jboss.jandex.AnnotationInstance annotation,
String propertyName)
Reads a String property value from the given annotation instance.
|
static <T> T |
value(org.jboss.jandex.AnnotationInstance annotation,
String name)
Convenience method to retrieve the named parameter from an annotation.
|
public static String refValue(org.jboss.jandex.AnnotationInstance annotation, JandexUtil.RefType refType)
annotation - AnnotationInstancerefType - RefTypepublic static <T> T value(org.jboss.jandex.AnnotationInstance annotation,
String name)
AnnotationValue.T - the type of the parameter being retrievedannotation - the annotation from which to fetch the parametername - the name of the parameterpublic static String stringValue(org.jboss.jandex.AnnotationInstance annotation, String propertyName)
annotation - AnnotationInstancepropertyName - Stringpublic static Optional<String> optionalStringValue(org.jboss.jandex.AnnotationInstance annotation, String propertyName)
public static Optional<Boolean> booleanValue(org.jboss.jandex.AnnotationInstance annotation, String propertyName)
annotation - AnnotationInstancepropertyName - Stringpublic static boolean booleanValueWithDefault(org.jboss.jandex.AnnotationInstance annotation,
String propertyName)
annotation - AnnotationInstancepropertyName - Stringpublic static Integer intValue(org.jboss.jandex.AnnotationInstance annotation, String propertyName)
annotation - AnnotationInstancepropertyName - Stringpublic static Optional<List<String>> stringListValue(org.jboss.jandex.AnnotationInstance annotation, String propertyName)
annotation - AnnotationInstancepropertyName - Stringpublic static <T extends Enum<?>> T enumValue(org.jboss.jandex.AnnotationInstance annotation, String propertyName, Class<T> clazz)
T - Type parameterannotation - AnnotationInstancepropertyName - Stringclazz - Class type of the Enumpublic static <T extends Enum<?>> T enumValue(String strVal, Class<T> clazz)
T - Type parameterstrVal - Stringclazz - Class type of the Enumpublic static boolean isRef(org.jboss.jandex.AnnotationInstance annotation)
annotation - AnnotationInstancepublic static boolean isEmpty(org.jboss.jandex.AnnotationInstance annotation)
annotation - AnnotationInstancepublic static org.jboss.jandex.AnnotationInstance getClassAnnotation(org.jboss.jandex.ClassInfo ct,
org.jboss.jandex.DotName name)
ct - ClassInfoname - DotNamepublic static List<org.jboss.jandex.AnnotationInstance> getParameterAnnotations(org.jboss.jandex.MethodInfo method, short paramPosition)
method - MethodInfoparamPosition - parameter positionpublic static String nameFromRef(org.jboss.jandex.AnnotationInstance annotation)
annotation - AnnotationInstancepublic static List<org.jboss.jandex.AnnotationInstance> getRepeatableAnnotation(org.jboss.jandex.AnnotationTarget target, org.jboss.jandex.DotName singleAnnotationName, org.jboss.jandex.DotName repeatableAnnotationName)
target - the annotated target (e.g. ClassInfo, MethodInfo)singleAnnotationName - DotNamerepeatableAnnotationName - DotNamepublic static org.jboss.jandex.Type getMethodParameterType(org.jboss.jandex.MethodInfo method,
short position)
method - MethodInfoposition - parameter positionpublic static org.jboss.jandex.Type getMethodParameterType(org.jboss.jandex.MethodParameterInfo parameter)
parameter - the parameterpublic static org.jboss.jandex.AnnotationInstance getMethodParameterAnnotation(org.jboss.jandex.MethodInfo method,
int parameterIndex,
org.jboss.jandex.DotName annotationName)
method - the methodparameterIndex - the parameter indexannotationName - name of annotation we are looking forpublic static List<org.jboss.jandex.AnnotationValue> schemaDisplayValues(org.jboss.jandex.AnnotationInstance annotation)
public static boolean isSimpleClassSchema(org.jboss.jandex.AnnotationInstance annotation)
annotation - AnnotationInstancepublic static boolean isSimpleArraySchema(org.jboss.jandex.AnnotationInstance annotation)
annotation - AnnotationInstancepublic static boolean isArraySchema(org.jboss.jandex.AnnotationInstance annotation)
@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.annotation - AnnotationInstance@Schemapublic static boolean hasImplementation(org.jboss.jandex.AnnotationInstance annotation)
@Schema
annotation has defined an "implementation" field.annotation - AnnotationInstancepublic static Map<org.jboss.jandex.ClassInfo,org.jboss.jandex.Type> inheritanceChain(org.jboss.jandex.IndexView index, org.jboss.jandex.ClassInfo klazz, org.jboss.jandex.Type type)
index - index for superclass retrievalklazz - the class to retrieve inheritancetype - type of the klazzpublic static boolean equals(org.jboss.jandex.AnnotationTarget t1,
org.jboss.jandex.AnnotationTarget t2)
public static boolean equals(org.jboss.jandex.ClassInfo c1,
org.jboss.jandex.ClassInfo c2)
public static boolean equals(org.jboss.jandex.FieldInfo f1,
org.jboss.jandex.FieldInfo f2)
public static boolean equals(org.jboss.jandex.MethodParameterInfo p1,
org.jboss.jandex.MethodParameterInfo p2)
Copyright © 2018–2021. All rights reserved.