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 delegate LineTokenizers as well as a mapping of String patterns to
delegate FieldSetMappers. 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.
PatternMatchingCompositeLineTokenizer| Constructor and Description |
|---|
PatternMatchingCompositeLineMapper() |
| Modifier and Type | Method and Description |
|---|---|
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) |
public T mapLine(java.lang.String line, int lineNumber) throws java.lang.Exception
LineMappermapLine in interface LineMapper<T>line - to be mappedlineNumber - of the current linejava.lang.Exception - if error occurred while parsing.public void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exceptionpublic void setTokenizers(java.util.Map<java.lang.String,LineTokenizer> tokenizers)
public void setFieldSetMappers(java.util.Map<java.lang.String,FieldSetMapper<T>> fieldSetMappers)