org.springframework.batch.item.file.transform

## Class ExtractorLineAggregator<T>

- java.lang.Object
- - org.springframework.batch.item.file.transform.ExtractorLineAggregator<T>

- All Implemented Interfaces:
    LineAggregator<T>
  Direct Known Subclasses:
    DelimitedLineAggregator, FormatterLineAggregator

      public abstract class ExtractorLineAggregator<T>
      extends java.lang.Object
      implements LineAggregator<T>

  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

    Constructors
    Constructor and Description
    `ExtractorLineAggregator()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `aggregate(T item)` Extract fields from the given item using the `FieldExtractor` and then aggregate them.
    `protected abstract java.lang.String` | `doAggregate(java.lang.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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ExtractorLineAggregator

          public ExtractorLineAggregator()

  - ### Method Detail

    - #### setFieldExtractor

          public void setFieldExtractor(FieldExtractor<T> fieldExtractor)

      Public setter for the field extractor responsible for splitting an input object up into an array of objects. Defaults to `PassThroughFieldExtractor`.
      Parameters:
        `fieldExtractor` - The field extractor to set

    - #### aggregate

          public java.lang.String aggregate(T item)

      Extract fields from the given item using the `FieldExtractor` 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 interface `LineAggregator<T>`
      Parameters:
        `item` - values to be converted
      Returns:
        string
      See Also:
        `LineAggregator.aggregate(java.lang.Object)`

    - #### doAggregate

          protected abstract java.lang.String doAggregate(java.lang.Object[] fields)

      Aggregate provided fields into single String.
      Parameters:
        `fields` - An array of the fields that must be aggregated
      Returns:
        aggregated string