Package com.docspring
Class JSON
java.lang.Object
com.docspring.JSON
- All Implemented Interfaces:
javax.ws.rs.ext.ContextResolver<com.fasterxml.jackson.databind.ObjectMapper>
@Generated(value="org.openapitools.codegen.languages.JavaClientCodegen",
comments="Generator version: 7.16.0-DOCSPRING")
public class JSON
extends Object
implements javax.ws.rs.ext.ContextResolver<com.fasterxml.jackson.databind.ObjectMapper>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Class<?>getClassForElement(com.fasterxml.jackson.databind.JsonNode node, Class<?> modelClass) Returns the target model class that should be used to deserialize the input data.com.fasterxml.jackson.databind.ObjectMappergetContext(Class<?> type) static JSONGet the default JSON instance.com.fasterxml.jackson.databind.ObjectMapperGet the object mapperstatic booleanisInstanceOf(Class<?> modelClass, Object inst, Set<Class<?>> visitedClasses) Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy.static voidregisterDescendants(Class<?> modelClass, Map<String, javax.ws.rs.core.GenericType<?>> descendants) Register the oneOf/anyOf descendants of the modelClass.static voidregisterDiscriminator(Class<?> modelClass, String discriminatorPropertyName, Map<String, Class<?>> mappings) Register a model class discriminator.voidsetDateFormat(DateFormat dateFormat) Set the date format for JSON (de)serialization with Date properties.static voidsetDefault(JSON json) Set the default JSON instance.
-
Constructor Details
-
JSON
public JSON()
-
-
Method Details
-
setDateFormat
Set the date format for JSON (de)serialization with Date properties.- Parameters:
dateFormat- Date format
-
getContext
- Specified by:
getContextin interfacejavax.ws.rs.ext.ContextResolver<com.fasterxml.jackson.databind.ObjectMapper>
-
getMapper
public com.fasterxml.jackson.databind.ObjectMapper getMapper()Get the object mapper- Returns:
- object mapper
-
getClassForElement
public static Class<?> getClassForElement(com.fasterxml.jackson.databind.JsonNode node, Class<?> modelClass) Returns the target model class that should be used to deserialize the input data. The discriminator mappings are used to determine the target model class.- Parameters:
node- The input data.modelClass- The class that contains the discriminator mappings.
-
isInstanceOf
Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy. The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy, so it's not possible to use the instanceof keyword.- Parameters:
modelClass- A OpenAPI model class.inst- The instance object.
-
registerDiscriminator
public static void registerDiscriminator(Class<?> modelClass, String discriminatorPropertyName, Map<String, Class<?>> mappings) Register a model class discriminator.- Parameters:
modelClass- the model classdiscriminatorPropertyName- the name of the discriminator propertymappings- a map with the discriminator mappings.
-
registerDescendants
public static void registerDescendants(Class<?> modelClass, Map<String, javax.ws.rs.core.GenericType<?>> descendants) Register the oneOf/anyOf descendants of the modelClass.- Parameters:
modelClass- the model classdescendants- a map of oneOf/anyOf descendants.
-
getDefault
Get the default JSON instance.- Returns:
- the default JSON instance
-
setDefault
Set the default JSON instance.- Parameters:
json- JSON instance to be used
-