Class Outcome<T>

java.lang.Object
com.saxonica.ee.trans.Outcome<T>

public class Outcome<T> extends Object
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 Details

    • Outcome

      public Outcome(T result)
      Create a success outcome
      Parameters:
      result - the successful outcome
    • Outcome

      public Outcome(Exception exception)
      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

      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 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