Class ProcessingResult

  • All Implemented Interfaces:

    
    public final class ProcessingResult<SUCCESS extends Object, FAILURE extends Object>
    
                        

    Quite often we want to return a value of particular type if the processing is successful and a value of another type in case of processing failure. This class allows to handle that, for example, we might have a method which fetches some data and returns it in case of success or returns error description in case of failure. Its return type can be defined as ProcessingResult<MyData, String> then.