Class JacksonJsonDataFormat
java.lang.Object
org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormat
- All Implemented Interfaces:
DataFormat<SpinJsonNode>
Spin data format that can wrap Json content and uses
Jackson as its implementation.
Caches an instance of
ObjectMapper
according to the advice given in the
Jackson documentation.- Author:
- Thorben Lindhauer, Stefan Hentschel
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
protected JacksonJsonDataFormatMapper
protected JacksonJsonDataFormatReader
protected JacksonJsonDataFormatWriter
protected com.jayway.jsonpath.Configuration
The JsonPath configurationprotected final String
protected com.fasterxml.jackson.databind.ObjectMapper
The Jackson Object Mapper used by this dataformatprotected List<TypeDetector>
-
Constructor Summary
ConstructorDescriptionJacksonJsonDataFormat
(String name) JacksonJsonDataFormat
(String name, com.fasterxml.jackson.databind.ObjectMapper objectMapper) JacksonJsonDataFormat
(String name, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.jayway.jsonpath.Configuration jsonPathConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTypeDetector
(TypeDetector typeDetector) com.fasterxml.jackson.databind.JavaType
constructJavaTypeFromCanonicalString
(String canonicalString) Constructs aJavaType
object based on the parameter, which has to follow Jackson's canonical type string format.com.fasterxml.jackson.databind.JsonNode
createJsonNode
(Boolean parameter) com.fasterxml.jackson.databind.JsonNode
createJsonNode
(Float parameter) com.fasterxml.jackson.databind.JsonNode
createJsonNode
(Integer parameter) com.fasterxml.jackson.databind.JsonNode
createJsonNode
(Long parameter) com.fasterxml.jackson.databind.JsonNode
createJsonNode
(Object parameter) com.fasterxml.jackson.databind.JsonNode
createJsonNode
(String parameter) com.fasterxml.jackson.databind.JsonNode
createJsonNode
(List<Object> parameter) com.fasterxml.jackson.databind.JsonNode
createJsonNode
(Map<String, Object> parameter) com.fasterxml.jackson.databind.JsonNode
createWrapperInstance
(Object parameter) getCanonicalTypeName
(Object object) Identifies the canonical type of an object heuristically.com.jayway.jsonpath.Configuration
Returns aConfiguration
object for jayway json path which uses this dataformat's object mapper asJsonProvider
.getName()
com.fasterxml.jackson.databind.ObjectMapper
Returns the configured JacksonObjectMapper
instance.Class<? extends SpinJsonNode>
protected void
init()
protected void
protected void
protected void
protected void
void
setJsonPathConfiguration
(com.jayway.jsonpath.Configuration jsonPathConfiguration) void
setObjectMapper
(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
Field Details
-
DATA_FORMAT_NAME
-
objectMapper
protected com.fasterxml.jackson.databind.ObjectMapper objectMapperThe Jackson Object Mapper used by this dataformat -
jsonPathConfiguration
protected com.jayway.jsonpath.Configuration jsonPathConfigurationThe JsonPath configuration -
typeDetectors
-
dataFormatReader
-
dataFormatWriter
-
dataFormatMapper
-
name
-
-
Constructor Details
-
JacksonJsonDataFormat
-
JacksonJsonDataFormat
-
JacksonJsonDataFormat
public JacksonJsonDataFormat(String name, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.jayway.jsonpath.Configuration jsonPathConfiguration)
-
-
Method Details
-
init
protected void init() -
initMapper
protected void initMapper() -
initWriter
protected void initWriter() -
initReader
protected void initReader() -
initTypeDetectors
protected void initTypeDetectors() -
getName
- Specified by:
getName
in interfaceDataFormat<SpinJsonNode>
-
getWrapperType
- Specified by:
getWrapperType
in interfaceDataFormat<SpinJsonNode>
-
createWrapperInstance
- Specified by:
createWrapperInstance
in interfaceDataFormat<SpinJsonNode>
-
getCanonicalTypeName
Identifies the canonical type of an object heuristically.- Returns:
- the canonical type identifier of the object's class
according to Jackson's type format (see
TypeFactory.constructFromCanonical(String)
)
-
constructJavaTypeFromCanonicalString
public com.fasterxml.jackson.databind.JavaType constructJavaTypeFromCanonicalString(String canonicalString) Constructs aJavaType
object based on the parameter, which has to follow Jackson's canonical type string format.- Parameters:
canonicalString
- canonical string representation of the type- Returns:
- the constructed java type
- Throws:
SpinJsonDataFormatException
- if no type can be constructed from the given parameter
-
addTypeDetector
-
getMapper
- Specified by:
getMapper
in interfaceDataFormat<SpinJsonNode>
- Returns:
- the DataFormatMapper used by this data format
-
getReader
- Specified by:
getReader
in interfaceDataFormat<SpinJsonNode>
-
getWriter
- Specified by:
getWriter
in interfaceDataFormat<SpinJsonNode>
-
getJsonPathConfiguration
public com.jayway.jsonpath.Configuration getJsonPathConfiguration()Returns aConfiguration
object for jayway json path which uses this dataformat's object mapper asJsonProvider
.- Returns:
- the
Configuration
for jsonpath
-
setJsonPathConfiguration
public void setJsonPathConfiguration(com.jayway.jsonpath.Configuration jsonPathConfiguration) -
getObjectMapper
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()Returns the configured JacksonObjectMapper
instance.- Returns:
- the configured object mapper.
-
setObjectMapper
public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
createJsonNode
-
createJsonNode
-
createJsonNode
-
createJsonNode
-
createJsonNode
-
createJsonNode
-
createJsonNode
-
createJsonNode
-
createNullJsonNode
public com.fasterxml.jackson.databind.JsonNode createNullJsonNode()
-