类 RegexLineTokenizer
- java.lang.Object
- org.springframework.batch.item.file.transform.AbstractLineTokenizer
- org.springframework.batch.item.file.transform.RegexLineTokenizer
- 所有已实现的接口:
LineTokenizer
public class RegexLineTokenizer extends AbstractLineTokenizer
Line-tokenizer using a regular expression to filter out data (by using matching and non-matching groups). Consider the following regex which picks only the first and last name (notice the non-matching group in the middle):(.*?)(?: .*)* (.*)
For the names:- "Graham James Edward Miller"
- "Andrew Gregory Macintyre"
- "No MiddleName"
- "Miller", "Graham"
- "Macintyre", "Andrew"
- "MiddleName", "No"
- 作者:
- Costin Leau
- 另请参阅:
Matcher.group(int)
字段概要
从类继承的字段 org.springframework.batch.item.file.transform.AbstractLineTokenizer
names
构造器概要
构造器 构造器 说明 RegexLineTokenizer()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected java.util.List<java.lang.String>
doTokenize(java.lang.String line)
void
setPattern(java.util.regex.Pattern pattern)
Sets the regex pattern to use.void
setRegex(java.lang.String regex)
Sets the regular expression to use.从类继承的方法 org.springframework.batch.item.file.transform.AbstractLineTokenizer
hasNames, isStrict, setFieldSetFactory, setNames, setStrict, tokenize
构造器详细资料
RegexLineTokenizer
public RegexLineTokenizer()
方法详细资料
doTokenize
protected java.util.List<java.lang.String> doTokenize(java.lang.String line)
- 指定者:
doTokenize
在类中AbstractLineTokenizer
setPattern
public void setPattern(java.util.regex.Pattern pattern)
Sets the regex pattern to use.- 参数:
pattern
- Regular Expression pattern
setRegex
public void setRegex(java.lang.String regex)
Sets the regular expression to use.- 参数:
regex
- regular expression (as a String)