类 JsonItemReaderBuilder<T>
- java.lang.Object
- org.springframework.batch.item.json.builder.JsonItemReaderBuilder<T>
- 类型参数:
T
- type of the target item
public class JsonItemReaderBuilder<T> extends java.lang.Object
A builder forJsonItemReader
.- 从以下版本开始:
- 4.1
- 作者:
- Mahmoud Ben Hassine
构造器概要
构造器 构造器 说明 JsonItemReaderBuilder()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 JsonItemReader<T>
build()
Validate the configuration and build a newJsonItemReader
.JsonItemReaderBuilder<T>
currentItemCount(int currentItemCount)
Index for the current item.JsonItemReaderBuilder<T>
jsonObjectReader(JsonObjectReader<T> jsonObjectReader)
Set theJsonObjectReader
to use to read and map Json objects to domain objects.JsonItemReaderBuilder<T>
maxItemCount(int maxItemCount)
Configure the max number of items to be read.JsonItemReaderBuilder<T>
name(java.lang.String name)
The name used to calculate the key within theExecutionContext
.JsonItemReaderBuilder<T>
resource(org.springframework.core.io.Resource resource)
TheResource
to be used as input.JsonItemReaderBuilder<T>
saveState(boolean saveState)
Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.JsonItemReaderBuilder<T>
strict(boolean strict)
Setting this value to true indicates that it is an error if the input does not exist and an exception will be thrown.
构造器详细资料
JsonItemReaderBuilder
public JsonItemReaderBuilder()
方法详细资料
jsonObjectReader
public JsonItemReaderBuilder<T> jsonObjectReader(JsonObjectReader<T> jsonObjectReader)
Set theJsonObjectReader
to use to read and map Json objects to domain objects.- 参数:
jsonObjectReader
- to use- 返回:
- The current instance of the builder.
- 另请参阅:
JsonItemReader.setJsonObjectReader(JsonObjectReader)
resource
public JsonItemReaderBuilder<T> resource(org.springframework.core.io.Resource resource)
TheResource
to be used as input.- 参数:
resource
- the input to the reader.- 返回:
- The current instance of the builder.
- 另请参阅:
JsonItemReader.setResource(Resource)
name
public JsonItemReaderBuilder<T> name(java.lang.String name)
The name used to calculate the key within theExecutionContext
. Required ifsaveState(boolean)
is set to true.- 参数:
name
- name of the reader instance- 返回:
- The current instance of the builder.
- 另请参阅:
ItemStreamSupport.setName(String)
strict
public JsonItemReaderBuilder<T> strict(boolean strict)
Setting this value to true indicates that it is an error if the input does not exist and an exception will be thrown. Defaults to true.- 参数:
strict
- indicates the input resource must exist- 返回:
- The current instance of the builder.
- 另请参阅:
JsonItemReader.setStrict(boolean)
saveState
public JsonItemReaderBuilder<T> saveState(boolean saveState)
Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.- 参数:
saveState
- defaults to true- 返回:
- The current instance of the builder.
maxItemCount
public JsonItemReaderBuilder<T> maxItemCount(int maxItemCount)
Configure the max number of items to be read.- 参数:
maxItemCount
- the max items to be read- 返回:
- The current instance of the builder.
- 另请参阅:
AbstractItemCountingItemStreamItemReader.setMaxItemCount(int)
currentItemCount
public JsonItemReaderBuilder<T> currentItemCount(int currentItemCount)
Index for the current item. Used on restarts to indicate where to start from.- 参数:
currentItemCount
- current index- 返回:
- The current instance of the builder.
- 另请参阅:
AbstractItemCountingItemStreamItemReader.setCurrentItemCount(int)
build
public JsonItemReader<T> build()
Validate the configuration and build a newJsonItemReader
.- 返回:
- a new instance of the
JsonItemReader