Interface CompletableFutures.IOResult<T>

Type Parameters:
T - the type of the result
All Superinterfaces:
CompletableFutures.Result<T,IOException>, com.ibm.asyncutil.util.Either<T,IOException>
Enclosing class:
CompletableFutures

public static interface CompletableFutures.IOResult<T> extends CompletableFutures.Result<T,IOException>
A specialization of the CompletableFutures.Result interface that represents the result of an I/O operation.
  • Method Details

    • voidResult

      static CompletableFutures.IOResult<Void> voidResult()
      Returns an CompletableFutures.IOResult that represents a successful execution of a I/O operation that does not produce a result.
      Type Parameters:
      T - the type of the result (which is always Void
      Returns:
      a IOResult instance that represents a successful execution of a I/O operation that does not produce a result
    • voidFuture

      Returns a CompletionStage instance that completes successfully with a CompletableFutures.SQLResult that represents a successful execution of a I/O operation that does not produce a result.
      Type Parameters:
      T - the type of the result (which is always Void
      Returns:
      a CompletionStage instance that completes successfully with a IOResult that represents a successful execution of a I/O operation that does not produce a result
    • mapSuccess

      default <U> CompletableFutures.IOResult<U> mapSuccess(Function<? super T,? extends U> fn)
      Description copied from interface: CompletableFutures.Result
      Maps the success value of this Result to a new Result of a different type by applying the given function. If this Result represents an error, a new Result with the same error is returned.
      Specified by:
      mapSuccess in interface CompletableFutures.Result<T,IOException>
      Type Parameters:
      U - the type of the success value of the new Result
      Parameters:
      fn - the function to apply to the success value
      Returns:
      a new Result with the mapped success value, or the same Result with the same error
    • flatMapSuccess

      default <U> CompletableFutures.IOResult<U> flatMapSuccess(Function<? super T,? extends CompletableFutures.IOResult<U>> fn)
      Maps the success value of this IOResult to the CompletableFutures.IOResult type returned from the given function. If this IOResult represents an error, a new IOResult with the same error is returned.
      Type Parameters:
      U - the type of the success value of the new IOResult
      Parameters:
      fn - the function which returns the new IOResult
      Returns:
      a IOResult with the mapped success value, or the same IOResult with the same error
    • getException

      default IOException getException()
      Description copied from interface: CompletableFutures.Result
      Returns the fail cause. If this Result represents success, an SQLStates.OK is returned.
      Specified by:
      getException in interface CompletableFutures.Result<T,IOException>
      Returns:
      the fail cause or SQLStates.OK if success
    • success

      static <T> CompletableFutures.IOResult<T> success(T item)
      Creates a new instance of IOResult that represents a successful I/O operation.
      Type Parameters:
      T - the type of the result
      Parameters:
      item - the result of the operation
      Returns:
      a new instance of IOResult that represents a successful I/O operation
    • fail

      static <T> CompletableFutures.IOResult<T> fail(IOException e)
      Creates a new instance of IOResult that represents a failed I/O operation.
      Type Parameters:
      T - the type of the result
      Parameters:
      e - the cause of the failure as an instance of IOException
      Returns:
      a new instance of IOResult that represents a failed I/O operation
    • successAsync

      static <T> CompletionStage<CompletableFutures.IOResult<T>> successAsync(T item)
      Creates a new completed stage that represents a successful execution of an I/O operation.
      Type Parameters:
      T - the type of the result
      Parameters:
      item - the result of the query
      Returns:
      a new instance of IOResult that represents a successful execution of an I/O operation
    • failAsync

      Creates a new completed stage that represents a failed execution of an I/O operation.
      Type Parameters:
      T - the type of the result
      Parameters:
      e - the cause of the failure as an instance of CompletableFutures.IOResult
      Returns:
      a new CompletionStage that represents a failed execution of an I/O operation
    • failOrMarshal

      static <T> CompletableFutures.IOResult<T> failOrMarshal(Throwable throwable)
      Returns a new Result object that represents a failed operation with the given IOException.
      Type Parameters:
      T - the type of the success value (unused in this case)
      Parameters:
      throwable - the IOException that caused the failure
      Returns:
      a new Result object that represents a failed operation with the given IOException
    • failOrMarshalAsync

      static <T> CompletionStage<CompletableFutures.IOResult<T>> failOrMarshalAsync(Throwable throwable)
      Returns a new completed staged that represents a failed operation with the given IOException.
      Type Parameters:
      T - the type of the success value (unused in this case)
      Parameters:
      throwable - the IOException that caused the failure
      Returns:
      a new CompletionStage object that represents a failed operation with the given IOException