Package com.ocient.util

# Interface CompletableFutures.Result<T,E extends Exception>

Type Parameters:
  `T` - the type of the success value

All Superinterfaces:
  `com.ibm.asyncutil.util.Either<T,E>`

All Known Subinterfaces:
  `CompletableFutures.IOResult<T>`, `CompletableFutures.SQLResult<T>`, `TransportResult<T>`

All Known Implementing Classes:
  `CompletableFutures.FailedResult`, `CompletableFutures.SuccessResult`, `TransportResult.FailedTransportResult`, `TransportResult.SuccessTransportResult`

Enclosing class:
  `CompletableFutures`

public static interface CompletableFutures.Result<T,E extends Exception> extends com.ibm.asyncutil.util.Either<T,E>
A Result represents the result of a operation that can either succeed with a value of type T, or fail with a SQLException.

## Method Summary

Modifier and Type
Method
Description
`default boolean`
`equals(CompletableFutures.Result<T,E> other)`
Equality operator for `CompletableFutures.SQLResult`.
`default T`
`get()`
Returns the success result reason.
`default E`
`getException()`
Returns the fail cause.
`default boolean`
`isException()`
Returns true if the operation failed, and false otherwise.
`default boolean`
`isSuccess()`
Returns true if the operation was successful, and false otherwise.
`default <U> CompletableFutures.Result<U,E>`
`mapSuccess(Function<? super T,? extends U> fn)`
Maps the success value of this Result to a new Result of a different type by applying the given function.
`default T`
`orElseThrow()`
Returns the success value of this Result.
`default T`
`recover(Function<? super E,? extends T> fn)`
Maps the error value of this Result to a new success value by applying the given function.
`static <E extends Exception>
CompletionStage<CompletableFutures.Result<Void,E>>`
`voidFuture()`
Returns a `CompletionStage` that completes successfully with a `CompletableFutures.Result` that represents a successful execution of an operation that does not produce a result.
`static <E extends Exception>
CompletableFutures.Result<Void,E>`
`voidResult()`
Returns a `CompletableFutures.Result` that represents a successful execution of an operation that does not produce a result.

### Methods inherited from interface com.ibm.asyncutil.util.Either

`flatMap, fold, forEach, isLeft, isRight, left, map, map, right`

## Method Details

### voidResult

static <E extends Exception> CompletableFutures.Result<Void,E> voidResult()
Returns a `CompletableFutures.Result` that represents a successful execution of an operation that does not produce a result.

Type Parameters:
  `E` - the type of the exception
  `T` - the type of the result (which is always `Void`
Returns:
  a `Result` that represents a successful execution of an operation that does not produce a result

### voidFuture

static <E extends Exception> CompletionStage<CompletableFutures.Result<Void,E>> voidFuture()
Returns a `CompletionStage` that completes successfully with a `CompletableFutures.Result` that represents a successful execution of an 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 `Result` that represents a successful execution of an operation that does not produce a result

### get

default T get() throws E
Returns the success result reason. If this Result represents an error, the fail cause is thrown.

Returns:
  the fail cause
Throws:
  `E` - if this Result represents an error

### getException

default E getException()
Returns the fail cause. If this Result represents success, an `SQLStates.OK` is returned.

Returns:
  the fail cause or `SQLStates.OK` if success

### orElseThrow

default T orElseThrow()
Returns the success value of this Result. If this Result represents an error, an IllegalStateException is thrown.

Returns:
  the success value
Throws:
  `IllegalStateException` - if this Result represents an error

### isException

default boolean isException()
Returns true if the operation failed, and false otherwise.

Returns:
  true if the operation failed, and false otherwise

### isSuccess

default boolean isSuccess()
Returns true if the operation was successful, and false otherwise.

Returns:
  true if the operation was successful, and false otherwise

### mapSuccess

default <U> CompletableFutures.Result<U,E> mapSuccess(Function<? super T,? extends U> fn)
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.

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

### recover

default T recover(Function<? super E,? extends T> fn)
Maps the error value of this Result to a new success value by applying the given function. If this Result represents a success, a new Result with the same success value is returned.

Parameters:
  `fn` - the function to apply to the error value
Returns:
  a new Result with the mapped error value, or the same Result with the same success value

### equals

default boolean equals(CompletableFutures.Result<T,E> other)
Equality operator for `CompletableFutures.SQLResult`.