Class AggregateItemFieldSetMapper<T>
- java.lang.Object
- org.springframework.batch.sample.domain.multiline.AggregateItemFieldSetMapper<T>
- All Implemented Interfaces:
FieldSetMapper<AggregateItem<T>>,org.springframework.beans.factory.InitializingBean
public class AggregateItemFieldSetMapper<T> extends java.lang.Object implements FieldSetMapper<AggregateItem<T>>, org.springframework.beans.factory.InitializingBean
Delegating mapper to convert form a vanillaFieldSetMapperto one that returnsAggregateIteminstances for consumption by theAggregateItemReader.- Author:
- Dave Syer
Constructor Summary
Constructors Constructor Description AggregateItemFieldSetMapper()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()Check mandatory properties (delegate).AggregateItem<T>mapFieldSet(FieldSet fieldSet)Build anAggregateItembased on matching the first column in the inputFieldSetto check for begin and end delimiters.voidsetBegin(java.lang.String begin)Public setter for the begin value.voidsetDelegate(FieldSetMapper<T> delegate)Public setter for the delegate.voidsetEnd(java.lang.String end)Public setter for the end field value.
Method Detail
setDelegate
public void setDelegate(FieldSetMapper<T> delegate)
Public setter for the delegate.- Parameters:
delegate- the delegate to set
setEnd
public void setEnd(java.lang.String end)
Public setter for the end field value. If theFieldSetinput 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(java.lang.String begin)
Public setter for the begin value. If theFieldSetinput 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 java.lang.ExceptionCheck mandatory properties (delegate).- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
java.lang.Exception- See Also:
InitializingBean.afterPropertiesSet()
mapFieldSet
public AggregateItem<T> mapFieldSet(FieldSet fieldSet) throws org.springframework.validation.BindException
Build anAggregateItembased on matching the first column in the inputFieldSetto 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:
mapFieldSetin interfaceFieldSetMapper<T>- Parameters:
fieldSet- aFieldSetto map- Returns:
- an
AggregateItemthat wraps the return value from the delegate - Throws:
org.springframework.validation.BindException- if one of the delegates does