org.springframework.batch.item.file.transform
Class FixedLengthLineAggregator

java.lang.Object
  extended by org.springframework.batch.item.file.transform.FixedLengthLineAggregator
All Implemented Interfaces:
LineAggregator

public class FixedLengthLineAggregator
extends Object
implements LineAggregator

LineAggregator implementation which produces line by aggregating provided strings into columns with fixed length. Columns are specified by array of ranges (setColumns(Range[]).

Author:
tomas.slanina, peter.zozom, Dave Syer

Constructor Summary
FixedLengthLineAggregator()
           
 
Method Summary
 String aggregate(FieldSet fieldSet)
          Aggregate provided strings into single line using specified column ranges.
 void setAlignment(Alignment alignment)
          Recognized alignments are CENTER, RIGHT, LEFT.
 void setColumns(Range[] columns)
          Set column ranges.
 void setPadding(char padding)
          Setter for padding (default is space).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedLengthLineAggregator

public FixedLengthLineAggregator()
Method Detail

setColumns

public void setColumns(Range[] columns)
Set column ranges. Used in conjunction with the RangeArrayPropertyEditor this property can be set in the form of a String describing the range boundaries, e.g. "1,4,7" or "1-3,4-6,7" or "1-2,4-5,7-10".

Parameters:
columns - array of Range objects which specify column start and end position

aggregate

public String aggregate(FieldSet fieldSet)
Aggregate provided strings into single line using specified column ranges.

Specified by:
aggregate in interface LineAggregator
Parameters:
fieldSet - arrays of strings representing data to be aggregated
Returns:
aggregated strings

setAlignment

public void setAlignment(Alignment alignment)
Recognized alignments are CENTER, RIGHT, LEFT. An IllegalArgumentException is thrown in case the argument does not match any of the recognized values.

Parameters:
alignment - the alignment to be used

setPadding

public void setPadding(char padding)
Setter for padding (default is space).

Parameters:
padding - the padding character


Copyright © 2009 SpringSource. All Rights Reserved.