Package io.smallrye.openapi.runtime.io
Class ModelIO<T,V,A extends V,O extends V,AB,OB>
java.lang.Object
io.smallrye.openapi.runtime.io.ModelIO<T,V,A,O,AB,OB>
- All Implemented Interfaces:
JsonIO.PropertyMapper<V,OB>
- Direct Known Subclasses:
APIResponsesIO,ComponentsIO,ContactIO,ContentIO,DiscriminatorIO,ExternalDocumentationIO,InfoIO,LicenseIO,MapModelIO,MediaTypeIO,OAuthFlowIO,OAuthFlowsIO,OpenAPIDefinitionIO,OperationIO,PathsIO,SecurityRequirementIO,SecurityRequirementsSetIO,ServerIO,TagIO
public abstract class ModelIO<T,V,A extends V,O extends V,AB,OB>
extends Object
implements JsonIO.PropertyMapper<V,OB>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.jboss.jandex.DotNameprotected final org.jboss.jandex.DotName -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <P extends Enum<P>>
Pprotected <P extends Enum<P>>
PextDocIO()org.jboss.jandex.AnnotationInstancegetAnnotation(org.jboss.jandex.AnnotationTarget target) getName(org.jboss.jandex.AnnotationInstance annotation) List<org.jboss.jandex.AnnotationInstance> getRepeatableAnnotations(org.jboss.jandex.AnnotationTarget target) booleanhasRepeatableAnnotation(org.jboss.jandex.AnnotationTarget target) headerIO()infoIO()jsonIO()linkIO()Optionally convert the entire object to a JSON value.voidMap any additional properties from the given model object to the nodeBuilder that will be the resulting JSON value.mapProperty(BaseModel<?> object, String propertyName, Object propertyValue) Optionally convert the property with given name and value to a JSON value.protected static <T> Predicate<T> optionalJsonArray(Object source) optionalJsonObject(Object source) pathsIO()<C extends org.eclipse.microprofile.openapi.models.Constructible>
Tabstract Tread(org.jboss.jandex.AnnotationInstance annotation) read(org.jboss.jandex.AnnotationTarget target) read(org.jboss.jandex.AnnotationValue annotation) protected Object<C extends org.eclipse.microprofile.openapi.models.Constructible>
CreadObject(Class<C> type, O node) readObject(O node) protected ObjectConvert JSON value node to an object when we have a desired typeschemaIO()serverIO()protected voidsetAllIfPresent(OB object, Optional<? extends O> valueSource) protected voidsetIfPresent(OB object, String key, Optional<? extends V> valueSource) voidsetOpenApiVersion(OpenApiVersion version) protected booleansetProperty(T model, String name, V value) protected booleansetProperty(T model, org.jboss.jandex.AnnotationValue value) tagIO()Creates a Collector for a stream of Map.Entry where the entry keys are Strings.protected <P> Pprotected <P> P
-
Field Details
-
annotationName
protected final org.jboss.jandex.DotName annotationName -
modelName
protected final org.jboss.jandex.DotName modelName
-
-
Constructor Details
-
ModelIO
-
-
Method Details
-
ioContext
-
jsonIO
-
scannerContext
-
setIfPresent
-
setAllIfPresent
-
optionalJsonObject
-
optionalJsonArray
-
entry
-
value
-
value
protected <P> P value(org.jboss.jandex.AnnotationInstance annotation, String propertyName, P defaultValue) -
enumValue
-
enumValue
-
getName
-
getName
-
not
-
toLinkedMap
Creates a Collector for a stream of Map.Entry where the entry keys are Strings. Null map entry values are allowed, but duplicate keys will result in an IllegalStateException being thrown. This method is the equivalent ofCollectors.toMap(java.util.function.Function, java.util.function.Function)where the given key and value mapping functions are simplyMap.Entry.getKey()andMap.Entry.getValue(), and where null values are tolerated.- Type Parameters:
T- the type of the map entry values- Returns:
- a collector allowing null values but forbidding duplicate keys.
-
getAnnotation
public org.jboss.jandex.AnnotationInstance getAnnotation(org.jboss.jandex.AnnotationTarget target) -
getRepeatableAnnotations
public List<org.jboss.jandex.AnnotationInstance> getRepeatableAnnotations(org.jboss.jandex.AnnotationTarget target) -
hasRepeatableAnnotation
public boolean hasRepeatableAnnotation(org.jboss.jandex.AnnotationTarget target) -
read
-
read
-
read
-
setProperty
-
read
-
readObject
-
readJson
-
readValue
Convert JSON value node to an object when we have a desired typeThe JSON value will be converted to the desired type if possible or returned as its native type if not.
- Parameters:
node- the JSON nodedesiredType- the type that we want to be returned- Returns:
- an object which represents the JSON node, which may or may not be of the desired type
-
setProperty
-
readValue
-
readObject
-
write
-
mapObject
Description copied from interface:JsonIO.PropertyMapperOptionally convert the entire object to a JSON value. If no value mapping should occur, implementations should return an empty Optional.- Specified by:
mapObjectin interfaceJsonIO.PropertyMapper<T,V> - Parameters:
object- model object that may be mapped to a JSON value- Returns:
- an optional JSON value that is mapped from the object
-
mapProperty
Description copied from interface:JsonIO.PropertyMapperOptionally convert the property with given name and value to a JSON value. If no value mapping should occur, implementations should return an empty Optional.- Specified by:
mapPropertyin interfaceJsonIO.PropertyMapper<T,V>
-
mapObject
Description copied from interface:JsonIO.PropertyMapperMap any additional properties from the given model object to the nodeBuilder that will be the resulting JSON value.- Specified by:
mapObjectin interfaceJsonIO.PropertyMapper<T,V>
-
openApiVersion
-
setOpenApiVersion
-
componentsIO
-
extDocIO
-
openApiDefinitionIO
-
operationIO
-
pathItemOperationIO
-
pathItemIO
-
pathsIO
-
callbackIO
-
callbackOperationIO
-
extensionIO
-
headerIO
-
contactIO
-
infoIO
-
licenseIO
-
linkIO
-
linkParameterIO
-
contentIO
-
discriminatorIO
-
encodingIO
-
exampleObjectIO
-
mediaTypeIO
-
schemaIO
-
parameterIO
-
requestBodyIO
-
apiResponseIO
-
apiResponsesIO
-
oauthFlowIO
-
oauthFlowsIO
-
oauthScopeIO
-
securityIO
-
securityRequirementIO
-
securityRequirementsSetIO
-
securitySchemeIO
-
serverIO
-
serverVariableIO
-
tagIO
-