Class TypeResolver
- java.lang.Object
-
- io.smallrye.openapi.runtime.scanner.dataobject.TypeResolver
-
public class TypeResolver extends Object
- Author:
- Marc Savy <marc@rhymewithgravy.com>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static 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.AnnotationTargetgetAnnotationTarget()Get the annotation target that represents this instance's schema property.StringgetBeanPropertyName()List<org.jboss.jandex.AnnotationTarget>getConstraintTargets()org.jboss.jandex.ClassInfogetDeclaringClass()Get the declaring class of the annotation target.org.jboss.jandex.FieldInfogetField()Retrieves the field associated with this property.StringgetPropertyName()Determine the name of the instance's property.org.jboss.jandex.MethodInfogetReadMethod()Retrieves the read method (getter) associated with this property.org.jboss.jandex.TypegetUnresolvedType()org.jboss.jandex.MethodInfogetWriteMethod()Retrieves the write method (setter) associated with this property.booleanisIgnored()booleanisReadOnly()booleanisWriteOnly()org.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.TyperesolveType()Resolve the type that was used to initially construct thisTypeResolver
-
-
-
Method Detail
-
resolve
public static org.jboss.jandex.Type resolve(org.jboss.jandex.Type type, TypeResolver resolver)
-
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
public String 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
public String 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
public List<org.jboss.jandex.AnnotationTarget> 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)
-
-