Class CompositeCustomerUpdateLineTokenizer
- java.lang.Object
- org.springframework.batch.core.listener.StepExecutionListenerSupport
- org.springframework.batch.sample.domain.trade.CompositeCustomerUpdateLineTokenizer
- All Implemented Interfaces:
StepExecutionListener
,StepListener
,LineTokenizer
public class CompositeCustomerUpdateLineTokenizer extends StepExecutionListenerSupport implements LineTokenizer
CompositeLineTokenizer
that delegates the tokenization of a line to one of two potential tokenizers. The file format in this case uses one character, either F, A, U, or D to indicate whether or not the line is an a footer record, or a customer add, update, or delete, and will delegate accordingly.- Since:
- 2.0
- Author:
- Lucas Ward
Constructor Summary
Constructors Constructor Description CompositeCustomerUpdateLineTokenizer()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beforeStep(StepExecution stepExecution)
Initialize the state of the listener with theStepExecution
from the current scope.void
setCustomerTokenizer(LineTokenizer customerTokenizer)
Set theLineTokenizer
that will be used to tokenize any lines that begin with A, U, or D, and are thus a customer operation.void
setFooterTokenizer(LineTokenizer footerTokenizer)
Set theLineTokenizer
that will be used to tokenize any lines that being with F and is thus a footer record.FieldSet
tokenize(java.lang.String line)
Yields the tokens resulting from the splitting of the suppliedline
.Methods inherited from class org.springframework.batch.core.listener.StepExecutionListenerSupport
afterStep
Method Detail
tokenize
public FieldSet tokenize(java.lang.String line)
Description copied from interface:LineTokenizer
Yields the tokens resulting from the splitting of the suppliedline
.- Specified by:
tokenize
in interfaceLineTokenizer
- Parameters:
line
- the line to be tokenized (can benull
)- Returns:
- the resulting tokens
beforeStep
public void beforeStep(StepExecution stepExecution)
Description copied from interface:StepExecutionListener
Initialize the state of the listener with theStepExecution
from the current scope.- Specified by:
beforeStep
in interfaceStepExecutionListener
- Overrides:
beforeStep
in classStepExecutionListenerSupport
- Parameters:
stepExecution
- instance ofStepExecution
.
setCustomerTokenizer
public void setCustomerTokenizer(LineTokenizer customerTokenizer)
Set theLineTokenizer
that will be used to tokenize any lines that begin with A, U, or D, and are thus a customer operation.- Parameters:
customerTokenizer
- tokenizer to delegate to for customer operation records
setFooterTokenizer
public void setFooterTokenizer(LineTokenizer footerTokenizer)
Set theLineTokenizer
that will be used to tokenize any lines that being with F and is thus a footer record.- Parameters:
footerTokenizer
- tokenizer to delegate to for footer records