类 PatternMatchingCompositeLineMapper<T>
- java.lang.Object
- org.springframework.batch.item.file.mapping.PatternMatchingCompositeLineMapper<T>
- 所有已实现的接口:
LineMapper<T>
,org.springframework.beans.factory.InitializingBean
public class PatternMatchingCompositeLineMapper<T> extends java.lang.Object implements LineMapper<T>, org.springframework.beans.factory.InitializingBean
A
LineMapper
implementation that stores a mapping of String patterns to delegateLineTokenizer
s as well as a mapping of String patterns to delegateFieldSetMapper
s. Each line received will be tokenized and then mapped to a field set.Both the tokenizing and the mapping work in a similar way. The line will be checked for its matching pattern. If the key matches a pattern in the map of delegates, then the corresponding delegate will be used. Patterns are sorted starting with the most specific, and the first match succeeds.
- 从以下版本开始:
- 2.0
- 作者:
- Dan Garrette, Dave Syer
- 另请参阅:
PatternMatchingCompositeLineTokenizer
构造器概要
构造器 构造器 说明 PatternMatchingCompositeLineMapper()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
T
mapLine(java.lang.String line, int lineNumber)
Implementations must implement this method to map the provided line to the parameter type T.void
setFieldSetMappers(java.util.Map<java.lang.String,FieldSetMapper<T>> fieldSetMappers)
void
setTokenizers(java.util.Map<java.lang.String,LineTokenizer> tokenizers)
构造器详细资料
PatternMatchingCompositeLineMapper
public PatternMatchingCompositeLineMapper()
方法详细资料
mapLine
public T mapLine(java.lang.String line, int lineNumber) throws java.lang.Exception
从接口复制的说明: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.- 指定者:
mapLine
在接口中LineMapper<T>
- 参数:
line
- to be mappedlineNumber
- of the current line- 返回:
- mapped object of type T
- 抛出:
java.lang.Exception
- if error occurred while parsing.
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
- 指定者:
afterPropertiesSet
在接口中org.springframework.beans.factory.InitializingBean
- 抛出:
java.lang.Exception
setTokenizers
public void setTokenizers(java.util.Map<java.lang.String,LineTokenizer> tokenizers)
setFieldSetMappers
public void setFieldSetMappers(java.util.Map<java.lang.String,FieldSetMapper<T>> fieldSetMappers)