Package com.saxonica.ee.trans
Class Outcome<T>
java.lang.Object
com.saxonica.ee.trans.Outcome<T>
An Outcome represents the result of a task, which might be success or failure
T
is the class of the result of the task in the event that it is successful-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the result of the task if it was unsuccessfulGet the result of the task if it was successfulboolean
Ask if the task was successful
-
Constructor Details
-
Outcome
Create a success outcome- Parameters:
result
- the successful outcome
-
Outcome
Create a failure outcome- Parameters:
exception
- the unsuccessful outcome
-
-
Method Details
-
isSuccess
public boolean isSuccess()Ask if the task was successful- Returns:
- true if the task was successful
-
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
Get the result of the task if it was unsuccessful- Returns:
- the result of the task if it was unsuccessful, or null otherwise
-