类 GsonJsonObjectReader<T>
- java.lang.Object
- org.springframework.batch.item.json.GsonJsonObjectReader<T>
- 类型参数:
T
- type of the target object
- 所有已实现的接口:
JsonObjectReader<T>
public class GsonJsonObjectReader<T> extends java.lang.Object implements JsonObjectReader<T>
Implementation ofJsonObjectReader
based on Google Gson.- 从以下版本开始:
- 4.1
- 作者:
- Mahmoud Ben Hassine
构造器概要
构造器 构造器 说明 GsonJsonObjectReader(java.lang.Class<? extends T> itemType)
Create a newGsonJsonObjectReader
instance.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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.google.gson.Gson mapper)
Set the object mapper to use to map Json objects to domain objects.
构造器详细资料
GsonJsonObjectReader
public GsonJsonObjectReader(java.lang.Class<? extends T> itemType)
Create a newGsonJsonObjectReader
instance.- 参数:
itemType
- the target item type
方法详细资料
setMapper
public void setMapper(com.google.gson.Gson mapper)
Set the object mapper to use to map Json objects to domain objects.- 参数:
mapper
- the object mapper to use
open
public void open(org.springframework.core.io.Resource resource) throws java.lang.Exception
从接口复制的说明:JsonObjectReader
Open the Json resource for reading.- 指定者:
open
在接口中JsonObjectReader<T>
- 参数:
resource
- the input resource- 抛出:
java.lang.Exception
- if unable to open the resource
read
public T read() throws java.lang.Exception
从接口复制的说明:JsonObjectReader
Read the next object in the Json resource if any.- 指定者:
read
在接口中JsonObjectReader<T>
- 返回:
- the next object or
null
if the resource is exhausted - 抛出:
java.lang.Exception
- if unable to read the next object
close
public void close() throws java.lang.Exception
从接口复制的说明:JsonObjectReader
Close the input resource.- 指定者:
close
在接口中JsonObjectReader<T>
- 抛出:
java.lang.Exception
- if unable to close the input resource