Class DefaultLineMapper<T>
- java.lang.Object
- org.springframework.batch.item.file.mapping.DefaultLineMapper<T>
- Type Parameters:
T- type of the item
- All Implemented Interfaces:
LineMapper<T>,org.springframework.beans.factory.InitializingBean
public class DefaultLineMapper<T> extends java.lang.Object implements LineMapper<T>, org.springframework.beans.factory.InitializingBean
Two-phaseLineMapperimplementation consisting of tokenization of the line intoFieldSetfollowed by mapping to item. If finer grained control of exceptions is needed, theLineMapperinterface should be implemented directly.- Author:
- Robert Kasanicky, Lucas Ward
Constructor Summary
Constructors Constructor Description DefaultLineMapper()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()TmapLine(java.lang.String line, int lineNumber)Implementations must implement this method to map the provided line to the parameter type T.voidsetFieldSetMapper(FieldSetMapper<T> fieldSetMapper)voidsetLineTokenizer(LineTokenizer tokenizer)
Method Detail
mapLine
public T mapLine(java.lang.String line, int lineNumber) throws java.lang.Exception
Description copied from interface:LineMapperImplementations must implement this method to map the provided line to the parameter type T. The line number represents the number of lines into a file the current line resides.- Specified by:
mapLinein interfaceLineMapper<T>- Parameters:
line- to be mappedlineNumber- of the current line- Returns:
- mapped object of type T
- Throws:
java.lang.Exception- if error occurred while parsing.
setLineTokenizer
public void setLineTokenizer(LineTokenizer tokenizer)
setFieldSetMapper
public void setFieldSetMapper(FieldSetMapper<T> fieldSetMapper)
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean