org.springframework.batch.item.file.transform
Class AbstractLineTokenizer

java.lang.Object
  extended by org.springframework.batch.item.file.transform.AbstractLineTokenizer
All Implemented Interfaces:
LineTokenizer
Direct Known Subclasses:
DelimitedLineTokenizer, FixedLengthTokenizer

public abstract class AbstractLineTokenizer
extends Object
implements LineTokenizer

Abstract class handling common concerns of various LineTokenizer implementations such as dealing with names and actual construction of FieldSet

Author:
Dave Syer, Robert Kasanicky, Lucas Ward

Field Summary
protected  String[] names
           
 
Constructor Summary
AbstractLineTokenizer()
           
 
Method Summary
protected abstract  List doTokenize(String line)
           
 boolean hasNames()
           
 void setNames(String[] names)
          Setter for column names.
 FieldSet tokenize(String line)
          Yields the tokens resulting from the splitting of the supplied line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

names

protected String[] names
Constructor Detail

AbstractLineTokenizer

public AbstractLineTokenizer()
Method Detail

setNames

public void setNames(String[] names)
Setter for column names. Optional, but if set, then all lines must have as many or fewer tokens.

Parameters:
names -

hasNames

public boolean hasNames()
Returns:
true if column names have been specified
See Also:
setNames(String[])

tokenize

public FieldSet tokenize(String line)
Yields the tokens resulting from the splitting of the supplied line.

Specified by:
tokenize in interface LineTokenizer
Parameters:
line - the line to be tokenised (can be null)
Returns:
the resulting tokens

doTokenize

protected abstract List doTokenize(String line)


Copyright © 2009 SpringSource. All Rights Reserved.