Class JsonItemReaderBuilder<T>
java.lang.Object
org.springframework.batch.item.json.builder.JsonItemReaderBuilder<T>
- Type Parameters:
T
- type of the target item
A builder for
JsonItemReader
.- Since:
- 4.1
- Author:
- Mahmoud Ben Hassine
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Validate the configuration and build a newJsonItemReader
.currentItemCount
(int currentItemCount) Index for the current item.jsonObjectReader
(JsonObjectReader<T> jsonObjectReader) Set theJsonObjectReader
to use to read and map Json objects to domain objects.maxItemCount
(int maxItemCount) Configure the max number of items to be read.The name used to calculate the key within theExecutionContext
.resource
(org.springframework.core.io.Resource resource) TheResource
to be used as input.saveState
(boolean saveState) Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.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.
-
Field Details
-
logger
protected org.apache.commons.logging.Log logger
-
-
Constructor Details
-
JsonItemReaderBuilder
public JsonItemReaderBuilder()
-
-
Method Details
-
jsonObjectReader
Set theJsonObjectReader
to use to read and map Json objects to domain objects.- Parameters:
jsonObjectReader
- to use- Returns:
- The current instance of the builder.
- See Also:
-
resource
TheResource
to be used as input.- Parameters:
resource
- the input to the reader.- Returns:
- The current instance of the builder.
- See Also:
-
name
The name used to calculate the key within theExecutionContext
. Required ifsaveState(boolean)
is set to true.- Parameters:
name
- name of the reader instance- Returns:
- The current instance of the builder.
- See Also:
-
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.- Parameters:
strict
- indicates the input resource must exist- Returns:
- The current instance of the builder.
- See Also:
-
saveState
Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.- Parameters:
saveState
- defaults to true- Returns:
- The current instance of the builder.
-
maxItemCount
Configure the max number of items to be read.- Parameters:
maxItemCount
- the max items to be read- Returns:
- The current instance of the builder.
- See Also:
-
currentItemCount
Index for the current item. Used on restarts to indicate where to start from.- Parameters:
currentItemCount
- current index- Returns:
- The current instance of the builder.
- See Also:
-
build
Validate the configuration and build a newJsonItemReader
.- Returns:
- a new instance of the
JsonItemReader
-