Class JacksonJsonObjectUnmarshaller<T>
java.lang.Object
org.springframework.batch.infrastructure.item.json.JacksonJsonObjectUnmarshaller<T>
- Type Parameters:
T- type of objects to unmarshal
- All Implemented Interfaces:
JsonObjectUnmarshaller<T>
A json object unmarshaller that uses Jackson 3 to unmarshal a json representation into
an object.
- Since:
- 6.1
- Author:
- Mahmoud Ben Hassine, Yanming Zhou
-
Constructor Summary
ConstructorsConstructorDescriptionJacksonJsonObjectUnmarshaller(Class<T> type) Create a newJacksonJsonObjectUnmarshallerwith a defaultJsonMapper.JacksonJsonObjectUnmarshaller(tools.jackson.core.type.TypeReference<T> type) Create a newJacksonJsonObjectUnmarshallerwith a defaultJsonMapper.JacksonJsonObjectUnmarshaller(tools.jackson.databind.json.JsonMapper jsonMapper, Class<T> type) Create a newJacksonJsonObjectUnmarshallerwith the providedJsonMapper.JacksonJsonObjectUnmarshaller(tools.jackson.databind.json.JsonMapper jsonMapper, tools.jackson.core.type.TypeReference<T> type) Create a newJacksonJsonObjectUnmarshallerwith the providedJsonMapper. -
Method Summary
-
Constructor Details
-
JacksonJsonObjectUnmarshaller
Create a newJacksonJsonObjectUnmarshallerwith a defaultJsonMapper.- Parameters:
type- the target type
-
JacksonJsonObjectUnmarshaller
Create a newJacksonJsonObjectUnmarshallerwith a defaultJsonMapper. Use this constructor for parameterized target types, for examplenew TypeReference<Map<String, Object>>() {}.- Parameters:
type- the target type
-
JacksonJsonObjectUnmarshaller
public JacksonJsonObjectUnmarshaller(tools.jackson.databind.json.JsonMapper jsonMapper, Class<T> type) Create a newJacksonJsonObjectUnmarshallerwith the providedJsonMapper.- Parameters:
jsonMapper- the json mapper to usetype- the target type
-
JacksonJsonObjectUnmarshaller
public JacksonJsonObjectUnmarshaller(tools.jackson.databind.json.JsonMapper jsonMapper, tools.jackson.core.type.TypeReference<T> type) Create a newJacksonJsonObjectUnmarshallerwith the providedJsonMapper. Use this constructor for parameterized target types, for examplenew TypeReference<Map<String, Object>>() {}.- Parameters:
jsonMapper- the json mapper to usetype- the target type
-
-
Method Details
-
unmarshal
Unmarshal the provided json into an object of the target type.- Specified by:
unmarshalin interfaceJsonObjectUnmarshaller<T>- Parameters:
json- the json representation of the object- Returns:
- the unmarshalled object
- Throws:
ParseException- if the json cannot be unmarshalled
-