org.springframework.batch.sample.domain.multiline
Class AggregateItemFieldSetMapper<T>

java.lang.Object
  extended by org.springframework.batch.sample.domain.multiline.AggregateItemFieldSetMapper<T>
All Implemented Interfaces:
FieldSetMapper<AggregateItem<T>>, InitializingBean

public class AggregateItemFieldSetMapper<T>
extends Object
implements FieldSetMapper<AggregateItem<T>>, InitializingBean

Delegating mapper to convert form a vanilla FieldSetMapper to one that returns AggregateItem instances for consumption by the AggregateItemReader.

Author:
Dave Syer

Constructor Summary
AggregateItemFieldSetMapper()
           
 
Method Summary
 void afterPropertiesSet()
          Check mandatory properties (delegate).
 AggregateItem<T> mapFieldSet(FieldSet fieldSet)
          Build an AggregateItem based on matching the first column in the input FieldSet to check for begin and end delimiters.
 void setBegin(String begin)
          Public setter for the begin value.
 void setDelegate(FieldSetMapper<T> delegate)
          Public setter for the delegate.
 void setEnd(String end)
          Public setter for the end field value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregateItemFieldSetMapper

public AggregateItemFieldSetMapper()
Method Detail

setDelegate

public void setDelegate(FieldSetMapper<T> delegate)
Public setter for the delegate.

Parameters:
delegate - the delegate to set

setEnd

public void setEnd(String end)
Public setter for the end field value. If the FieldSet input has a first field with this value that signals the start of an aggregate record.

Parameters:
end - the end to set

setBegin

public void setBegin(String begin)
Public setter for the begin value. If the FieldSet input has a first field with this value that signals the end of an aggregate record.

Parameters:
begin - the begin to set

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Check mandatory properties (delegate).

Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception
See Also:
InitializingBean.afterPropertiesSet()

mapFieldSet

public AggregateItem<T> mapFieldSet(FieldSet fieldSet)
Build an AggregateItem based on matching the first column in the input FieldSet to check for begin and end delimiters. If the current record is neither a begin nor an end marker then it is mapped using the delegate.

Specified by:
mapFieldSet in interface FieldSetMapper<AggregateItem<T>>
Parameters:
fieldSet - a FieldSet to map
Returns:
an AggregateItem that wraps the return value from the delegate


Copyright © 2009 SpringSource. All Rights Reserved.