T
- type of the target objectpublic class JacksonJsonObjectReader<T> extends java.lang.Object implements JsonObjectReader<T>
JsonObjectReader
based on
Jackson.Constructor and Description |
---|
JacksonJsonObjectReader(java.lang.Class<? extends T> itemType)
Create a new
JacksonJsonObjectReader instance. |
JacksonJsonObjectReader(com.fasterxml.jackson.databind.ObjectMapper mapper,
java.lang.Class<? extends T> itemType) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the input resource.
|
void |
open(org.springframework.core.io.Resource resource)
Open the Json resource for reading.
|
T |
read()
Read the next object in the Json resource if any.
|
void |
setMapper(com.fasterxml.jackson.databind.ObjectMapper mapper)
Set the object mapper to use to map Json objects to domain objects.
|
public JacksonJsonObjectReader(java.lang.Class<? extends T> itemType)
JacksonJsonObjectReader
instance.itemType
- the target item typepublic JacksonJsonObjectReader(com.fasterxml.jackson.databind.ObjectMapper mapper, java.lang.Class<? extends T> itemType)
public void setMapper(com.fasterxml.jackson.databind.ObjectMapper mapper)
mapper
- the object mapper to useJacksonJsonObjectReader(ObjectMapper, Class)
public void open(org.springframework.core.io.Resource resource) throws java.lang.Exception
JsonObjectReader
open
in interface JsonObjectReader<T>
resource
- the input resourcejava.lang.Exception
- if unable to open the resource@Nullable public T read() throws java.lang.Exception
JsonObjectReader
read
in interface JsonObjectReader<T>
null
if the resource is exhaustedjava.lang.Exception
- if unable to read the next objectpublic void close() throws java.lang.Exception
JsonObjectReader
close
in interface JsonObjectReader<T>
java.lang.Exception
- if unable to close the input resource