Interface ServiceOutcome<T>


public interface ServiceOutcome<T>
This interface represents a service method call result. A service method call can either completes successfully and returns some value OR it can fail with one or more errors.
  • Method Details

    • isValid

      boolean isValid()
      Did the service method call complete successfully?
      Returns:
      true if method call completes successfully, otherwise false.
    • getErrorCollection

      ErrorCollection getErrorCollection()
      Returns:
      ErrorCollection that contains any errors that occurred during the service call. The returned ErrorCollection may not contain any errors if the method call completes successfully.
    • get

      T get()
      Returns:
      the value that corresponds to the service method call result.
      Throws:
      IllegalStateException - when called on an invalid ServiceOutcome
    • error

      static <T> ServiceOutcome<T> error(ErrorCollection errorCollection)
    • ok

      static <T> ServiceOutcome<T> ok(T value)