R
- type of the processing outputpublic final class ProcessingResult<R extends MessageProvider> extends Object
This class is useful when you write your own wrappers over processors and want to be able to customize the output for said classes. It offers two static factory methods and offers the ability to grab the processing result, the processing report and the success status.
It also offers a wrapper which swallows ProcessingException
s and
wraps them in a report instead (which will always be a ListProcessingReport
: in this case, the exception message will always be
the first message in the report.
Modifier and Type | Method and Description |
---|---|
ProcessingReport |
getReport()
Get the report out of this result
|
R |
getResult()
Get the result of the computation
|
boolean |
isSuccess()
Tell whether the result is a success
|
static <IN extends MessageProvider,OUT extends MessageProvider> |
of(Processor<IN,OUT> processor,
ProcessingReport report,
IN input)
Build a result out of a processor, a report and an input
|
static <IN extends MessageProvider,OUT extends MessageProvider> |
uncheckedResult(Processor<IN,OUT> processor,
ProcessingReport report,
IN input)
Build a result out of a computation and wrap any processing exception
|
public static <IN extends MessageProvider,OUT extends MessageProvider> ProcessingResult<OUT> of(Processor<IN,OUT> processor, ProcessingReport report, IN input) throws ProcessingException
IN
- type of the inputOUT
- type of the outputprocessor
- the processorreport
- the reportinput
- the inputProcessingException
- processing failedNullPointerException
- the processor or report are nullpublic static <IN extends MessageProvider,OUT extends MessageProvider> ProcessingResult<OUT> uncheckedResult(Processor<IN,OUT> processor, ProcessingReport report, IN input)
IN
- type of the inputOUT
- type of the outputprocessor
- the processor to usereport
- the report to useinput
- the inputNullPointerException
- the processor or report are nullpublic ProcessingReport getReport()
public R getResult()
Note that in the event of a processing failure, the return value of this method is undefined.
public boolean isSuccess()
ProcessingReport.isSuccess()