Class AvroItemReaderBuilder<T>
java.lang.Object
org.springframework.batch.item.avro.builder.AvroItemReaderBuilder<T>
A builder implementation for the
AvroItemReader
.- Since:
- 4.2
- Author:
- David Turanski, Mahmoud Ben Hassine
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build an instance ofAvroItemReader
.currentItemCount
(int currentItemCount) Index for the current item.embeddedSchema
(boolean embeddedSchema) Disable or enable reading an embedded Avro schema.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) Configure aResource
containing Avro serialized objects.saveState
(boolean saveState) Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.Configure an AvroSchema
from a String.schema
(org.springframework.core.io.Resource schema) Configure an AvroSchema
from aResource
.Configure a type to be deserialized.
-
Constructor Details
-
AvroItemReaderBuilder
public AvroItemReaderBuilder()
-
-
Method Details
-
resource
Configure aResource
containing Avro serialized objects.- Parameters:
resource
- an existing Resource.- Returns:
- The current instance of the builder.
-
schema
Configure an AvroSchema
from aResource
.- Parameters:
schema
- an existing schema Resource.- Returns:
- The current instance of the builder.
-
schema
Configure an AvroSchema
from a String.- Parameters:
schemaString
- the schema String.- Returns:
- The current instance of the builder.
-
type
Configure a type to be deserialized.- Parameters:
type
- the class to be deserialized.- Returns:
- The current instance of the builder.
-
embeddedSchema
Disable or enable reading an embedded Avro schema. True by default.- Parameters:
embeddedSchema
- set to false to if the input does not contain an Avro schema.- Returns:
- The current instance of the builder.
-
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.
-
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:
-
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:
- this instance for method chaining
- See Also:
-
build
Build an instance ofAvroItemReader
.- Returns:
- the instance;
-