public class JacksonJsonDataFormat extends Object implements DataFormat
Modifier and Type | Field and Description |
---|---|
protected String |
name |
protected com.fasterxml.jackson.databind.ObjectMapper |
objectMapper |
protected List<TypeDetector> |
typeDetectors |
Constructor and Description |
---|
JacksonJsonDataFormat(String name) |
JacksonJsonDataFormat(String name,
com.fasterxml.jackson.databind.ObjectMapper objectMapper) |
Modifier and Type | Method and Description |
---|---|
boolean |
canMap(Object parameter)
Returns true if this data format can map the provided Java Object.
|
com.fasterxml.jackson.databind.JavaType |
constructJavaTypeFromCanonicalString(String canonicalString) |
String |
getCanonicalTypeName(Object value)
Returns a data-format-specific canonical type name.
|
String |
getName()
Returns the data format name.
|
com.fasterxml.jackson.databind.ObjectMapper |
getObjectMapper() |
<T> T |
readValue(String value,
Class<T> cls)
Reads the internal representation of a data format to a java object of the
desired class.
|
protected <C> C |
readValue(String value,
com.fasterxml.jackson.databind.JavaType type) |
<T> T |
readValue(String value,
String typeIdentifier)
Reads the internal representation of a data format to a java object of the
desired class.
|
void |
setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) |
String |
writeValue(Object value)
Writes a java object to a data format's internal data representation.
|
protected String name
protected com.fasterxml.jackson.databind.ObjectMapper objectMapper
protected List<TypeDetector> typeDetectors
public JacksonJsonDataFormat(String name)
public JacksonJsonDataFormat(String name, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
public String getName()
DataFormat
getName
in interface DataFormat
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
public boolean canMap(Object parameter)
DataFormat
canMap
in interface DataFormat
public String writeValue(Object value)
DataFormat
writeValue
in interface DataFormat
value
- object that is written into internal data representationpublic <T> T readValue(String value, String typeIdentifier)
DataFormat
readValue
in interface DataFormat
value
- the object to be readtypeIdentifier
- the class to map the object topublic <T> T readValue(String value, Class<T> cls)
DataFormat
readValue
in interface DataFormat
value
- the object to be readcls
- a data-format-specific type identifier that describes
the class to map toprotected <C> C readValue(String value, com.fasterxml.jackson.databind.JavaType type)
public com.fasterxml.jackson.databind.JavaType constructJavaTypeFromCanonicalString(String canonicalString)
public String getCanonicalTypeName(Object value)
DataFormat
getCanonicalTypeName
in interface DataFormat
Copyright © 2022. All rights reserved.