org.springframework.batch.item.file.mapping
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>, InitializingBean
public class DefaultLineMapper<T>
- extends Object
- implements LineMapper<T>, InitializingBean
Two-phase LineMapper
implementation consisting of tokenization of the
line into FieldSet
followed by mapping to item. By default, any exceptions
thrown by either delegates will be wrapped in a FlatFileParseException
before
being rethrown. If finer grained control of exceptions is needed, the LineMapper
interface should be implemented directly.
- Author:
- Robert Kasanicky, Lucas Ward
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultLineMapper
public DefaultLineMapper()
mapLine
public T mapLine(String line,
int lineNumber)
throws Exception
- Description copied from interface:
LineMapper
- Implementations 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:
mapLine
in interface LineMapper<T>
- Parameters:
line
- to be mappedlineNumber
- of the current line
- Returns:
- mapped object of type T
- Throws:
Exception
- if error occured while parsing.
setLineTokenizer
public void setLineTokenizer(LineTokenizer tokenizer)
setFieldSetMapper
public void setFieldSetMapper(FieldSetMapper<T> fieldSetMapper)
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSet
in interface InitializingBean
Copyright © 2009 SpringSource. All Rights Reserved.