类 AbstractLineTokenizer
- java.lang.Object
- org.springframework.batch.item.file.transform.AbstractLineTokenizer
- 所有已实现的接口:
LineTokenizer
public abstract class AbstractLineTokenizer extends java.lang.Object implements LineTokenizer
Abstract class handling common concerns of variousLineTokenizerimplementations such as dealing with names and actual construction ofFieldSet- 作者:
- Dave Syer, Robert Kasanicky, Lucas Ward, Michael Minella
字段概要
字段 修饰符和类型 字段 说明 protected java.lang.String[]names
构造器概要
构造器 构造器 说明 AbstractLineTokenizer()
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected abstract java.util.List<java.lang.String>doTokenize(java.lang.String line)booleanhasNames()protected booleanisStrict()Provides access to the strict flag for subclasses if needed.voidsetFieldSetFactory(FieldSetFactory fieldSetFactory)Factory forFieldSetinstances.voidsetNames(java.lang.String... names)Setter for column names.voidsetStrict(boolean strict)Public setter for the strict flag.FieldSettokenize(java.lang.String line)Yields the tokens resulting from the splitting of the suppliedline.
字段详细资料
names
protected java.lang.String[] names
构造器详细资料
AbstractLineTokenizer
public AbstractLineTokenizer()
方法详细资料
setStrict
public void setStrict(boolean strict)
Public setter for the strict flag. If true (the default) then number of tokens in line must match the number of tokens defined (byRange, columns, etc.) inLineTokenizer. If false then lines with less tokens will be tolerated and padded with empty columns, and lines with more tokens will simply be truncated.- 参数:
strict- the strict flag to set
isStrict
protected boolean isStrict()
Provides access to the strict flag for subclasses if needed.- 返回:
- the strict flag value
setFieldSetFactory
public void setFieldSetFactory(FieldSetFactory fieldSetFactory)
Factory forFieldSetinstances. Can be injected by clients to customize the default number and date formats.- 参数:
fieldSetFactory- theFieldSetFactoryto set
setNames
public void setNames(java.lang.String... names)
Setter for column names. Optional, but if set, then all lines must have as many or fewer tokens.- 参数:
names- names of each column
hasNames
public boolean hasNames()
- 返回:
trueif column names have been specified- 另请参阅:
setNames(String[])
tokenize
public FieldSet tokenize(java.lang.String line)
Yields the tokens resulting from the splitting of the suppliedline.- 指定者:
tokenize在接口中LineTokenizer- 参数:
line- the line to be tokenized (can benull)- 返回:
- the resulting tokens
doTokenize
protected abstract java.util.List<java.lang.String> doTokenize(java.lang.String line)