Class ExtractorLineAggregator<T>
java.lang.Object
org.springframework.batch.item.file.transform.ExtractorLineAggregator<T>
- All Implemented Interfaces:
LineAggregator<T>
- Direct Known Subclasses:
DelimitedLineAggregator
,FormatterLineAggregator
An abstract
LineAggregator
implementation that utilizes a
FieldExtractor
to convert the incoming object to an array of its parts.
Extending classes must decide how those parts will be aggregated together.- Since:
- 2.0
- Author:
- Dan Garrette
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionExtract fields from the given item using theFieldExtractor
and then aggregate them.protected abstract String
doAggregate
(Object[] fields) Aggregate provided fields into single String.void
setFieldExtractor
(FieldExtractor<T> fieldExtractor) Public setter for the field extractor responsible for splitting an input object up into an array of objects.
-
Constructor Details
-
ExtractorLineAggregator
public ExtractorLineAggregator()
-
-
Method Details
-
setFieldExtractor
Public setter for the field extractor responsible for splitting an input object up into an array of objects. Defaults toPassThroughFieldExtractor
.- Parameters:
fieldExtractor
- The field extractor to set
-
aggregate
Extract fields from the given item using theFieldExtractor
and then aggregate them. Any null field returned by the extractor will be replaced by an empty String. Null items are not allowed.- Specified by:
aggregate
in interfaceLineAggregator<T>
- Parameters:
item
- values to be converted- Returns:
- string
- See Also:
-
doAggregate
Aggregate provided fields into single String.- Parameters:
fields
- An array of the fields that must be aggregated- Returns:
- aggregated string
-