IN
- input type for that processorOUT
- output type for that processorpublic final class CachingProcessor<IN extends MessageProvider,OUT extends MessageProvider> extends Object implements Processor<IN,OUT>
Processor
You can use this over whichever processor of your choice. Internally, it
uses a LoadingCache
to store results.
You can optionally pass an Equivalence
as an argument for cache
keys. By default, Equivalences.equals()
will be used.
Constructor and Description |
---|
CachingProcessor(Processor<IN,OUT> processor)
Constructor
|
CachingProcessor(Processor<IN,OUT> processor,
com.google.common.base.Equivalence<IN> equivalence)
Main constructor
|
Modifier and Type | Method and Description |
---|---|
OUT |
process(ProcessingReport report,
IN input)
Process the input
|
String |
toString() |
public CachingProcessor(Processor<IN,OUT> processor)
This is equivalent to calling CachingProcessor(Processor,
Equivalence)
with Equivalences.equals()
as the second argument.
processor
- the processorpublic CachingProcessor(Processor<IN,OUT> processor, com.google.common.base.Equivalence<IN> equivalence)
processor
- the processorequivalence
- an equivalence to use for cache keysNullPointerException
- processor or equivalence are nullpublic OUT process(ProcessingReport report, IN input) throws ProcessingException
Processor
process
in interface Processor<IN extends MessageProvider,OUT extends MessageProvider>
report
- the report to use while processinginput
- the input for this processorProcessingException
- processing failedCopyright © 2016. All rights reserved.