IN
- the input type for that chainOUT
- the output type for that chainpublic final class ProcessorChain<IN extends MessageProvider,OUT extends MessageProvider> extends Object
This class allows to build a chain out of different Processor
instances. The result behaves like a processor itself, so it can be used in
other chains as well.
Sample usage:
final Processor<X, Y> chain = ProcessorChain.startWith(p1) .chainWith(p2).chainWith(...).getProcessor(); // input is of type X final Y ret = chain.process(report, X);
Modifier and Type | Method and Description |
---|---|
<NEWOUT extends MessageProvider> |
chainWith(Processor<OUT,NEWOUT> p2)
Add an existing processor to that chain
|
ProcessorChain<IN,OUT> |
failOnError() |
Processor<IN,OUT> |
getProcessor() |
static <X extends MessageProvider,Y extends MessageProvider> |
startWith(Processor<X,Y> p)
Start a processing chain with a single processor
|
public static <X extends MessageProvider,Y extends MessageProvider> ProcessorChain<X,Y> startWith(Processor<X,Y> p)
X
- the input typeY
- the output typep
- the processorpublic ProcessorChain<IN,OUT> failOnError()
public <NEWOUT extends MessageProvider> ProcessorChain<IN,NEWOUT> chainWith(Processor<OUT,NEWOUT> p2)
Note that this returns a new chain.
NEWOUT
- the return type for that new processorp2
- the processor to addCopyright © 2013. All Rights Reserved.