类 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 ofJsonObjectReaderbased on Google Gson.- 从以下版本开始:
- 4.1
- 作者:
- Mahmoud Ben Hassine
构造器概要
构造器 构造器 说明 GsonJsonObjectReader(java.lang.Class<? extends T> itemType)Create a newGsonJsonObjectReaderinstance.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidclose()Close the input resource.voidopen(org.springframework.core.io.Resource resource)Open the Json resource for reading.Tread()Read the next object in the Json resource if any.voidsetMapper(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 newGsonJsonObjectReaderinstance.- 参数:
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
从接口复制的说明:JsonObjectReaderOpen 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
从接口复制的说明:JsonObjectReaderRead the next object in the Json resource if any.- 指定者:
read在接口中JsonObjectReader<T>- 返回:
- the next object or
nullif the resource is exhausted - 抛出:
java.lang.Exception- if unable to read the next object
close
public void close() throws java.lang.Exception
从接口复制的说明:JsonObjectReaderClose the input resource.- 指定者:
close在接口中JsonObjectReader<T>- 抛出:
java.lang.Exception- if unable to close the input resource