Class TypeResolver
java.lang.Object
io.smallrye.openapi.runtime.scanner.dataobject.TypeResolver
- Author:
- Marc Savy <marc@rhymewithgravy.com>
-
Method Summary
Modifier and TypeMethodDescriptionstatic TypeResolverforClass(AnnotationScannerContext context, org.jboss.jandex.ClassInfo clazz, org.jboss.jandex.Type leaf) Create a new TypeResolver for the given ClassInfo clazz and type.static Map<String, TypeResolver> getAllFields(AnnotationScannerContext context, org.jboss.jandex.Type leaf, org.jboss.jandex.ClassInfo leafKlazz, org.jboss.jandex.AnnotationTarget reference) org.jboss.jandex.AnnotationTargetGet the annotation target that represents this instance's schema property.List<org.jboss.jandex.AnnotationTarget> org.jboss.jandex.ClassInfoGet the declaring class of the annotation target.org.jboss.jandex.FieldInfogetField()Retrieves the field associated with this property.Determine the name of the instance's property.org.jboss.jandex.MethodInfoRetrieves the read method (getter) associated with this property.org.jboss.jandex.Typeorg.jboss.jandex.MethodInfoRetrieves the write method (setter) associated with this property.booleanbooleanbooleanorg.jboss.jandex.Typeresolve(org.jboss.jandex.Type type) Resolve a parameterized type against thisTypeResolver's resolution stack.static org.jboss.jandex.Typeresolve(org.jboss.jandex.Type type, TypeResolver resolver) static Optional<org.jboss.jandex.ParameterizedType> resolveParameterizedAncestor(AnnotationScannerContext context, org.jboss.jandex.Type type, org.jboss.jandex.Type seekType) org.jboss.jandex.TypeResolve the type that was used to initially construct thisTypeResolver
-
Method Details
-
resolve
-
getDeclaringClass
public org.jboss.jandex.ClassInfo getDeclaringClass()Get the declaring class of the annotation target.- Returns:
- the
ClassInfoof the class that declares the optimal annotation target for the type represented by the current instance.
-
getAnnotationTarget
public org.jboss.jandex.AnnotationTarget getAnnotationTarget()Get the annotation target that represents this instance's schema property.- Returns:
- the optimal annotation target for the type represented by the current instance.
-
getUnresolvedType
public org.jboss.jandex.Type getUnresolvedType() -
getPropertyName
Determine the name of the instance's property. The name may be overridden by one of several annotations, selected in the following order:- MP Open API
@Schema - JSON-B
@JsonbProperty - Jackson
@JsonProperty - JAXB
@XmlElement - JAXB
@XmlAttribute
- Returns:
- name of property
- MP Open API
-
getBeanPropertyName
-
getField
public org.jboss.jandex.FieldInfo getField()Retrieves the field associated with this property. May be null.- Returns:
- field property
-
getReadMethod
public org.jboss.jandex.MethodInfo getReadMethod()Retrieves the read method (getter) associated with this property. May be null.- Returns:
- the property's read method (getter)
-
getWriteMethod
public org.jboss.jandex.MethodInfo getWriteMethod()Retrieves the write method (setter) associated with this property. May be null.- Returns:
- the property's write method (setter)
-
resolveType
public org.jboss.jandex.Type resolveType()Resolve the type that was used to initially construct thisTypeResolver- Returns:
- the resolved type (if found)
-
isIgnored
public boolean isIgnored() -
isReadOnly
public boolean isReadOnly() -
isWriteOnly
public boolean isWriteOnly() -
resolve
public org.jboss.jandex.Type resolve(org.jboss.jandex.Type type) Resolve a parameterized type against thisTypeResolver's resolution stack. If any of the type's arguments are wild card types, the resolution will fall back to the basicgetResolvedType(Type)method, resolving none of the arguments.- Parameters:
type- type to resolve- Returns:
- resolved type (if found)
-
getConstraintTargets
-
forClass
public static TypeResolver forClass(AnnotationScannerContext context, org.jboss.jandex.ClassInfo clazz, org.jboss.jandex.Type leaf) Create a new TypeResolver for the given ClassInfo clazz and type. If the Type leaf if not available, the type of the clazz will be used, without parameters.- Parameters:
context- current scanner contextclazz- class to be resolvedleaf- the type of clazz where referenced- Returns:
- a new TypeResolver
-
getAllFields
public static Map<String,TypeResolver> getAllFields(AnnotationScannerContext context, org.jboss.jandex.Type leaf, org.jboss.jandex.ClassInfo leafKlazz, org.jboss.jandex.AnnotationTarget reference) -
resolveParameterizedAncestor
public static Optional<org.jboss.jandex.ParameterizedType> resolveParameterizedAncestor(AnnotationScannerContext context, org.jboss.jandex.Type type, org.jboss.jandex.Type seekType)
-