Class MappingLdifReaderBuilder<T>
java.lang.Object
org.springframework.batch.item.ldif.builder.MappingLdifReaderBuilder<T>
Creates a fully qualified MappingLdifReader.
- Since:
- 4.0
- Author:
- Glenn Renfro
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns a fully constructedMappingLdifReader.currentItemCount(int currentItemCount) Index for the current item.maxItemCount(int maxItemCount) Configure the max number of items to be read.The name used to calculate the key within theExecutionContext.recordMapper(RecordMapper<T> recordMapper) Setter for object mapper.recordsToSkip(int recordsToSkip) Public setter for the number of lines to skip at the start of a file.resource(org.springframework.core.io.Resource resource) Establishes the resource that will be used as the input for the MappingLdifReader.saveState(boolean saveState) Configure if the state of theItemStreamSupportshould be persisted within theExecutionContextfor restart purposes.skippedRecordsCallback(RecordCallbackHandler skippedRecordsCallback) RecordCallbackHandlerimplementations can be used to take action on skipped records.strict(boolean strict) In strict mode the reader will throw an exception onAbstractItemCountingItemStreamItemReader.open(org.springframework.batch.item.ExecutionContext)if the input resource does not exist.
-
Constructor Details
-
MappingLdifReaderBuilder
public MappingLdifReaderBuilder()
-
-
Method Details
-
saveState
Configure if the state of theItemStreamSupportshould be persisted within theExecutionContextfor 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:
-
strict
In strict mode the reader will throw an exception onAbstractItemCountingItemStreamItemReader.open(org.springframework.batch.item.ExecutionContext)if the input resource does not exist.- Parameters:
strict- true by default- Returns:
- this instance for method chaining.
- See Also:
-
skippedRecordsCallback
public MappingLdifReaderBuilder<T> skippedRecordsCallback(RecordCallbackHandler skippedRecordsCallback) RecordCallbackHandlerimplementations can be used to take action on skipped records.- Parameters:
skippedRecordsCallback- will be called for each one of the initial skipped lines before any items are read.- Returns:
- this instance for method chaining.
- See Also:
-
recordsToSkip
Public setter for the number of lines to skip at the start of a file. Can be used if the file contains a header without useful (column name) information, and without a comment delimiter at the beginning of the lines.- Parameters:
recordsToSkip- the number of lines to skip- Returns:
- this instance for method chaining.
- See Also:
-
resource
Establishes the resource that will be used as the input for the MappingLdifReader.- Parameters:
resource- the resource that will be read.- Returns:
- this instance for method chaining.
- See Also:
-
recordMapper
Setter for object mapper. This property is required to be set.- Parameters:
recordMapper- maps record to an object- Returns:
- this instance for method chaining.
-
build
Returns a fully constructedMappingLdifReader.- Returns:
- a new
MappingLdifReader
-