public class TypeUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
allowRegistration(org.jboss.jandex.IndexView index,
org.jboss.jandex.Type classType)
Determines if a type is eligible for registration.
|
static void |
applyTypeAttributes(org.jboss.jandex.Type classType,
org.eclipse.microprofile.openapi.models.media.Schema schema)
Sets the default schema attributes for the given type on the provided schema
instance.
|
static io.smallrye.openapi.runtime.util.TypeUtil.TypeWithFormat |
arrayFormat() |
static void |
clearMatchingDefaultAttributes(org.eclipse.microprofile.openapi.models.media.Schema fieldSchema,
org.eclipse.microprofile.openapi.models.media.Schema typeSchema)
Removes the known default schema attributes from the fieldSchema if they are also
present and have the same value in the typeSchema.
|
static boolean |
equalTypes(org.jboss.jandex.Type type1,
org.jboss.jandex.Type type2) |
static boolean |
equalWrappedTypes(org.jboss.jandex.Type primitiveCandidate,
org.jboss.jandex.Type wrappedCandidate) |
static org.jboss.jandex.AnnotationInstance |
getAnnotation(org.jboss.jandex.AnnotationTarget annotationTarget,
org.jboss.jandex.DotName annotationName) |
static org.jboss.jandex.AnnotationInstance |
getAnnotation(org.jboss.jandex.ClassInfo field,
org.jboss.jandex.DotName annotationName) |
static org.jboss.jandex.AnnotationInstance |
getAnnotation(org.jboss.jandex.FieldInfo field,
org.jboss.jandex.DotName annotationName) |
static org.jboss.jandex.AnnotationInstance |
getAnnotation(org.jboss.jandex.Type type,
org.jboss.jandex.DotName annotationName) |
static Collection<org.jboss.jandex.AnnotationInstance> |
getAnnotations(org.jboss.jandex.AnnotationTarget type) |
static <T> T |
getAnnotationValue(org.jboss.jandex.AnnotationTarget target,
org.jboss.jandex.DotName annotationName)
Convenience method to retrieve the "value" parameter from an annotation bound to the target.
|
static <T> T |
getAnnotationValue(org.jboss.jandex.AnnotationTarget target,
org.jboss.jandex.DotName annotationName,
String propertyName)
Convenience method to retrieve the named parameter from an annotation bound to the target.
|
static <T> T |
getAnnotationValue(org.jboss.jandex.AnnotationTarget target,
org.jboss.jandex.DotName annotationName,
String propertyName,
T defaultValue)
Convenience method to retrieve the named parameter from an annotation bound to the target.
|
static org.jboss.jandex.Type |
getBound(org.jboss.jandex.WildcardType wct) |
static org.jboss.jandex.ClassInfo |
getDeclaringClass(org.jboss.jandex.AnnotationTarget type) |
static org.jboss.jandex.DotName |
getName(org.jboss.jandex.Type type) |
static org.jboss.jandex.Type |
getOptionalType(org.jboss.jandex.Type type)
Unwraps the type parameter (generic or primitive) from the given optional
type.
|
static org.jboss.jandex.AnnotationInstance |
getSchemaAnnotation(org.jboss.jandex.AnnotationTarget annotationTarget) |
static org.jboss.jandex.AnnotationInstance |
getSchemaAnnotation(org.jboss.jandex.ClassInfo field) |
static org.jboss.jandex.AnnotationInstance |
getSchemaAnnotation(org.jboss.jandex.FieldInfo field) |
static org.jboss.jandex.AnnotationInstance |
getSchemaAnnotation(org.jboss.jandex.Type type) |
static Map<String,Object> |
getTypeAttributes(org.jboss.jandex.Type classType)
Retrieves the read-only Map of schema attributes for the given type.
|
static boolean |
hasAnnotation(org.jboss.jandex.AnnotationTarget target,
org.jboss.jandex.DotName annotationName) |
static boolean |
isA(org.jboss.jandex.IndexView index,
org.jboss.jandex.Type testSubject,
org.jboss.jandex.Type testObject)
Test whether testSubject is an instanceof type test.
|
static boolean |
isOptional(org.jboss.jandex.Type type)
Determine if a given type is one of the following types:
java.util.Optional
java.util.OptionalDouble
java.util.OptionalInt
java.util.OptionalLong
|
static boolean |
isPrimitiveWrapper(org.jboss.jandex.PrimitiveType primitive,
org.jboss.jandex.Type wrapped) |
static boolean |
isTerminalType(org.jboss.jandex.Type type) |
static io.smallrye.openapi.runtime.util.TypeUtil.TypeWithFormat |
objectFormat() |
static org.jboss.jandex.Type |
resolveWildcard(org.jboss.jandex.Type type) |
static org.jboss.jandex.Type |
resolveWildcard(org.jboss.jandex.WildcardType wildcardType) |
public static boolean allowRegistration(org.jboss.jandex.IndexView index,
org.jboss.jandex.Type classType)
index - index of classes to considerclassType - the type to checkpublic static Map<String,Object> getTypeAttributes(org.jboss.jandex.Type classType)
classType - the typepublic static void applyTypeAttributes(org.jboss.jandex.Type classType,
org.eclipse.microprofile.openapi.models.media.Schema schema)
classType - the typeschema - a writable schema to be updated with the type's default schema attributespublic static void clearMatchingDefaultAttributes(org.eclipse.microprofile.openapi.models.media.Schema fieldSchema,
org.eclipse.microprofile.openapi.models.media.Schema typeSchema)
fieldSchema - the schema for a field of the type described by typeSchematypeSchema - the schema for a class typepublic static io.smallrye.openapi.runtime.util.TypeUtil.TypeWithFormat arrayFormat()
public static io.smallrye.openapi.runtime.util.TypeUtil.TypeWithFormat objectFormat()
public static boolean isA(org.jboss.jandex.IndexView index,
org.jboss.jandex.Type testSubject,
org.jboss.jandex.Type testObject)
For example, test whether List is a Collection.
Attempts to work with both Jandex and using standard class.
index - Jandex indextestSubject - type to testtestObject - type to test againstpublic static boolean isTerminalType(org.jboss.jandex.Type type)
public static boolean isOptional(org.jboss.jandex.Type type)
java.util.Optional
java.util.OptionalDouble
java.util.OptionalInt
java.util.OptionalLong
type - the type to checkpublic static org.jboss.jandex.Type getOptionalType(org.jboss.jandex.Type type)
type - the type to unwrapjava.util.Optional, otherwise the optional primitive double, int, or
longpublic static org.jboss.jandex.DotName getName(org.jboss.jandex.Type type)
public static org.jboss.jandex.Type getBound(org.jboss.jandex.WildcardType wct)
public static org.jboss.jandex.Type resolveWildcard(org.jboss.jandex.WildcardType wildcardType)
public static org.jboss.jandex.Type resolveWildcard(org.jboss.jandex.Type type)
public static boolean equalTypes(org.jboss.jandex.Type type1,
org.jboss.jandex.Type type2)
public static boolean equalWrappedTypes(org.jboss.jandex.Type primitiveCandidate,
org.jboss.jandex.Type wrappedCandidate)
public static boolean isPrimitiveWrapper(org.jboss.jandex.PrimitiveType primitive,
org.jboss.jandex.Type wrapped)
public static org.jboss.jandex.AnnotationInstance getSchemaAnnotation(org.jboss.jandex.AnnotationTarget annotationTarget)
public static org.jboss.jandex.AnnotationInstance getSchemaAnnotation(org.jboss.jandex.ClassInfo field)
public static org.jboss.jandex.AnnotationInstance getSchemaAnnotation(org.jboss.jandex.FieldInfo field)
public static org.jboss.jandex.AnnotationInstance getSchemaAnnotation(org.jboss.jandex.Type type)
public static boolean hasAnnotation(org.jboss.jandex.AnnotationTarget target,
org.jboss.jandex.DotName annotationName)
public static org.jboss.jandex.AnnotationInstance getAnnotation(org.jboss.jandex.AnnotationTarget annotationTarget,
org.jboss.jandex.DotName annotationName)
public static <T> T getAnnotationValue(org.jboss.jandex.AnnotationTarget target,
org.jboss.jandex.DotName annotationName)
AnnotationValue.T - the type of the parameter being retrievedtarget - the target object annotated with the annotation named by annotationNameannotationName - name of the annotation from which to retrieve the valuepublic static <T> T getAnnotationValue(org.jboss.jandex.AnnotationTarget target,
org.jboss.jandex.DotName annotationName,
String propertyName)
AnnotationValue.T - the type of the parameter being retrievedtarget - the target object annotated with the annotation named by annotationNameannotationName - name of the annotation from which to retrieve the valuepropertyName - the name of the parameter/property in the annotationpublic static <T> T getAnnotationValue(org.jboss.jandex.AnnotationTarget target,
org.jboss.jandex.DotName annotationName,
String propertyName,
T defaultValue)
AnnotationValue.T - the type of the parameter being retrievedtarget - the target object annotated with the annotation named by annotationNameannotationName - name of the annotation from which to retrieve the valuepropertyName - the name of the parameter/property in the annotationdefaultValue - a default value to return if either the annotation or the value are missingpublic static Collection<org.jboss.jandex.AnnotationInstance> getAnnotations(org.jboss.jandex.AnnotationTarget type)
public static org.jboss.jandex.ClassInfo getDeclaringClass(org.jboss.jandex.AnnotationTarget type)
public static org.jboss.jandex.AnnotationInstance getAnnotation(org.jboss.jandex.Type type,
org.jboss.jandex.DotName annotationName)
public static org.jboss.jandex.AnnotationInstance getAnnotation(org.jboss.jandex.ClassInfo field,
org.jboss.jandex.DotName annotationName)
public static org.jboss.jandex.AnnotationInstance getAnnotation(org.jboss.jandex.FieldInfo field,
org.jboss.jandex.DotName annotationName)
Copyright © 2018–2020. All rights reserved.