Package com.saxonica.ee.trans
Class Outcome<T>
- java.lang.Object
-
- com.saxonica.ee.trans.Outcome<T>
-
public class Outcome<T> extends java.lang.Object
An Outcome represents the result of a task, which might be success or failureT
is the class of the result of the task in the event that it is successful
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Exception
getException()
Get the result of the task if it was unsuccessfulT
getResult()
Get the result of the task if it was successfulboolean
isSuccess()
Ask if the task was successful
-
-
-
Constructor Detail
-
Outcome
public Outcome(T result)
Create a success outcome- Parameters:
result
- the successful outcome
-
Outcome
public Outcome(java.lang.Exception exception)
Create a failure outcome- Parameters:
exception
- the unsuccessful outcome
-
-
Method Detail
-
isSuccess
public boolean isSuccess()
Ask if the task was successful- Returns:
- true if the task was successful
-
getResult
public T getResult()
Get the result of the task if it was successful- Returns:
- the result of the task if it was successful, or null otherwise
-
getException
public java.lang.Exception getException()
Get the result of the task if it was unsuccessful- Returns:
- the result of the task if it was unsuccessful, or null otherwise
-
-