Class EntityObjectMapper
java.lang.Object
com.fasterxml.jackson.core.TreeCodec
com.fasterxml.jackson.core.ObjectCodec
com.fasterxml.jackson.databind.ObjectMapper
is.codion.framework.json.domain.EntityObjectMapper
- All Implemented Interfaces:
com.fasterxml.jackson.core.Versioned, Serializable
public final class EntityObjectMapper
extends com.fasterxml.jackson.databind.ObjectMapper
Entity object mapper for mapping
Entity and Entity.Key to and from JSON.
For instances use the entityObjectMapper(Entities) factory method or a builder(),
which starts from the configuration of the domain's EntityObjectMapper.Configurer, in case one is registered as a service.
A mapper is configured by its builder only, its configuration fixed once built. It is not to be reconfigured
through the methods it inherits from ObjectMapper, registerModule() and configure() for example.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn abstractEntityObjectMapper.Configurerimplementation, extend to configure the mappers of a domain.static interfaceBuilds aEntityObjectMapper.static interfaceConfigures theEntityObjectMapperinstances of a domain: the serializers and deserializers of its custom types, and the parameter and return types of its procedures, functions and reports.Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.ObjectMapper
com.fasterxml.jackson.databind.ObjectMapper.DefaultTypeResolverBuilder, com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.fasterxml.jackson.core.type.TypeReference<List<Entity.Key>> Fields inherited from class com.fasterxml.jackson.databind.ObjectMapper
_coercionConfigs, _configOverrides, _deserializationConfig, _deserializationContext, _injectableValues, _jsonFactory, _mixIns, _registeredModuleTypes, _rootDeserializers, _serializationConfig, _serializerFactory, _serializerProvider, _subtypeResolver, _typeFactory, DEFAULT_ANNOTATION_INTROSPECTOR, DEFAULT_BASE -
Method Summary
Modifier and TypeMethodDescriptionbuilder()deserializeCondition(EntityDefinition definition, com.fasterxml.jackson.databind.JsonNode conditionNode) Deserializes the given conditiondeserializeEntities(InputStream inputStream) Deserializes the given JSON input stream into a list of Entity instancesdeserializeEntities(String jsonString) Deserializes the given JSON string into a list of Entity instancesdeserializeKeys(InputStream inputStream) Deserializes the given JSON input stream into a list of Key instancesdeserializeKeys(String jsonString) Deserializes the given JSON string into a list of Key instancesentities()static EntityObjectMapperentityObjectMapper(Entities entities) A factory method forEntityObjectMapperinstances, configured by the domain'sEntityObjectMapper.Configurer, in case one is registered as a service.com.fasterxml.jackson.databind.JavaTypeparameter(FunctionType<?, ?, ?> functionType) Returns the type the given function's parameter is deserialized as, when the function is called over a JSON connection.com.fasterxml.jackson.databind.JavaTypeparameter(ProcedureType<?, ?> procedureType) Returns the type the given procedure's parameter is deserialized as, when the procedure is called over a JSON connection.com.fasterxml.jackson.databind.JavaTypeparameter(ReportType<?, ?> reportType) Returns the type the given report's parameter is deserialized as, when the report is filled over a JSON connection.com.fasterxml.jackson.databind.JavaTypereturnType(FunctionType<?, ?, ?> functionType) Returns the type the given function's return value is serialized as and deserialized from, when the function is called over a JSON connection.com.fasterxml.jackson.databind.JavaTypereturnType(ReportType<?, ?> reportType) Returns the type the given report's result is serialized as and deserialized from, when the report is filled over a JSON connection.voidserializeCondition(Condition condition, com.fasterxml.jackson.core.JsonGenerator generator) Serializes the given conditionMethods inherited from class com.fasterxml.jackson.databind.ObjectMapper
_assertNotNull, _checkInvalidCopy, _configAndWriteValue, _constructDefaultTypeResolverBuilder, _convert, _findRootDeserializer, _initForReading, _newReader, _newReader, _newWriter, _newWriter, _newWriter, _readMapAndClose, _readTreeAndClose, _readValue, _serializerProvider, _verifyNoTrailingTokens, _verifySchemaType, _writeValueAndClose, acceptJsonFormatVisitor, acceptJsonFormatVisitor, activateDefaultTyping, activateDefaultTyping, activateDefaultTyping, activateDefaultTypingAsProperty, addHandler, addMixIn, addMixInAnnotations, canDeserialize, canDeserialize, canSerialize, canSerialize, clearCaches, clearProblemHandlers, coercionConfigDefaults, coercionConfigFor, coercionConfigFor, configOverride, configure, configure, configure, configure, configure, configure, constructType, constructType, convertValue, convertValue, convertValue, copy, copyWith, createArrayNode, createDeserializationContext, createGenerator, createGenerator, createGenerator, createGenerator, createGenerator, createNonBlockingByteArrayParser, createObjectNode, createParser, createParser, createParser, createParser, createParser, createParser, createParser, createParser, createParser, createParser, deactivateDefaultTyping, defaultClassIntrospector, disable, disable, disable, disable, disable, disable, disable, disableDefaultTyping, enable, enable, enable, enable, enable, enable, enable, enableDefaultTyping, enableDefaultTyping, enableDefaultTyping, enableDefaultTypingAsProperty, findAndRegisterModules, findMixInClassFor, findModules, findModules, generateJsonSchema, getDateFormat, getDeserializationConfig, getDeserializationContext, getEnumNamingStrategy, getFactory, getInjectableValues, getNodeFactory, getPolymorphicTypeValidator, getPropertyNamingStrategy, getRegisteredModuleIds, getSerializationConfig, getSerializerFactory, getSerializerProvider, getSerializerProviderInstance, getSubtypeResolver, getTypeFactory, getVisibilityChecker, isEnabled, isEnabled, isEnabled, isEnabled, isEnabled, isEnabled, isEnabled, isEnabled, missingNode, mixInCount, nullNode, reader, reader, reader, reader, reader, reader, reader, reader, reader, reader, reader, readerFor, readerFor, readerFor, readerForArrayOf, readerForListOf, readerForMapOf, readerForUpdating, readerWithView, readTree, readTree, readTree, readTree, readTree, readTree, readTree, readTree, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValue, readValues, readValues, readValues, readValues, registerModule, registerModules, registerModules, registerSubtypes, registerSubtypes, registerSubtypes, setAccessorNaming, setAnnotationIntrospector, setAnnotationIntrospectors, setBase64Variant, setCacheProvider, setConfig, setConfig, setConstructorDetector, setDateFormat, setDefaultAttributes, setDefaultLeniency, setDefaultMergeable, setDefaultPrettyPrinter, setDefaultPropertyInclusion, setDefaultPropertyInclusion, setDefaultSetterInfo, setDefaultTyping, setDefaultVisibility, setEnumNamingStrategy, setFilterProvider, setFilters, setHandlerInstantiator, setInjectableValues, setLocale, setMixInAnnotations, setMixInResolver, setMixIns, setNodeFactory, setPolymorphicTypeValidator, setPropertyInclusion, setPropertyNamingStrategy, setSerializationInclusion, setSerializerFactory, setSerializerProvider, setSubtypeResolver, setTimeZone, setTypeFactory, setVisibility, setVisibility, setVisibilityChecker, tokenStreamFactory, treeAsTokens, treeToValue, treeToValue, treeToValue, updateValue, valueToTree, version, writer, writer, writer, writer, writer, writer, writer, writer, writer, writer, writerFor, writerFor, writerFor, writerWithDefaultPrettyPrinter, writerWithType, writerWithType, writerWithType, writerWithView, writeTree, writeTree, writeValue, writeValue, writeValue, writeValue, writeValue, writeValueAsBytes, writeValueAsStringMethods inherited from class com.fasterxml.jackson.core.ObjectCodec
getJsonFactory
-
Field Details
-
KEY_LIST_REFERENCE
public static final com.fasterxml.jackson.core.type.TypeReference<List<Entity.Key>> KEY_LIST_REFERENCE -
ENTITY_LIST_REFERENCE
-
-
Method Details
-
entities
- Returns:
- the underlying domain model entities
-
serializeCondition
public void serializeCondition(Condition condition, com.fasterxml.jackson.core.JsonGenerator generator) throws IOException Serializes the given condition- Parameters:
condition- the condition to serializegenerator- the json generator- Throws:
IOException- in case of an exception
-
deserializeCondition
public Condition deserializeCondition(EntityDefinition definition, com.fasterxml.jackson.databind.JsonNode conditionNode) throws IOException Deserializes the given condition- Parameters:
definition- the entity definitionconditionNode- the condition node to deserialize- Returns:
- the deserialized Condition instance
- Throws:
IOException- in case of an exception
-
deserializeEntities
public List<Entity> deserializeEntities(String jsonString) throws com.fasterxml.jackson.core.JsonProcessingException Deserializes the given JSON string into a list of Entity instances- Parameters:
jsonString- the JSON string to parse- Returns:
- a List containing the Entity instances represented by the given JSON string
- Throws:
com.fasterxml.jackson.core.JsonProcessingException- in case of an exception
-
deserializeEntities
Deserializes the given JSON input stream into a list of Entity instances- Parameters:
inputStream- the JSON input stream to parse- Returns:
- a List containing the Entity instances represented by the given JSON input stream
- Throws:
IOException- in case of an exception
-
deserializeKeys
public List<Entity.Key> deserializeKeys(String jsonString) throws com.fasterxml.jackson.core.JsonProcessingException Deserializes the given JSON string into a list of Key instances- Parameters:
jsonString- the JSON string to parse- Returns:
- a List containing the Key instances represented by the given JSON string
- Throws:
com.fasterxml.jackson.core.JsonProcessingException- in case of an exception
-
deserializeKeys
Deserializes the given JSON input stream into a list of Key instances- Parameters:
inputStream- the JSON input stream to parse- Returns:
- a List containing the Key instances represented by the given JSON input stream
- Throws:
IOException- in case of an exception
-
parameter
Returns the type the given procedure's parameter is deserialized as, when the procedure is called over a JSON connection.- Parameters:
procedureType- the procedure type- Returns:
- the parameter type registered for the given procedure
- Throws:
IllegalStateException- in case no parameter type has been registered for the procedure- See Also:
-
parameter
Returns the type the given function's parameter is deserialized as, when the function is called over a JSON connection.- Parameters:
functionType- the function type- Returns:
- the parameter type registered for the given function
- Throws:
IllegalStateException- in case no parameter type has been registered for the function- See Also:
-
parameter
Returns the type the given report's parameter is deserialized as, when the report is filled over a JSON connection.- Parameters:
reportType- the report type- Returns:
- the parameter type registered for the given report
- Throws:
IllegalStateException- in case no parameter type has been registered for the report- See Also:
-
returnType
Returns the type the given function's return value is serialized as and deserialized from, when the function is called over a JSON connection.- Parameters:
functionType- the function type- Returns:
- the return type registered for the given function
- Throws:
IllegalStateException- in case no return type has been registered for the function- See Also:
-
returnType
Returns the type the given report's result is serialized as and deserialized from, when the report is filled over a JSON connection.- Parameters:
reportType- the report type- Returns:
- the return type registered for the given report
- Throws:
IllegalStateException- in case no return type has been registered for the report- See Also:
-
entityObjectMapper
A factory method forEntityObjectMapperinstances, configured by the domain'sEntityObjectMapper.Configurer, in case one is registered as a service.- Parameters:
entities- the domain entities- Returns:
- a new
EntityObjectMapperinstance based on the given entities - Throws:
IllegalStateException- in case more than oneEntityObjectMapper.Configureris registered for the domain- See Also:
-
builder
- Returns:
- a
EntityObjectMapper.Builder.EntitiesStep
-