Package com.ocient.util
Class CompletableFutures.SuccessResult<T,E extends Exception>
java.lang.Object
com.ocient.util.CompletableFutures.SuccessResult<T,E>
- Type Parameters:
T- the type of the success value
- All Implemented Interfaces:
com.ibm.asyncutil.util.Either<T,,E> CompletableFutures.Result<T,E>
- Direct Known Subclasses:
TransportResult.SuccessTransportResult
- Enclosing class:
- CompletableFutures
public static class CompletableFutures.SuccessResult<T,E extends Exception>
extends Object
implements CompletableFutures.Result<T,E>
A Result that represents a successful operation T.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean<V> VApplies the given functions to the success value and theException, respectively, and returns the result of applying the success value function.get()Returns the success result reason.Returns the fail cause.inthashCode()booleanisLeft()booleanisRight()Returns the success value of this Result.toString()Returns a string representation of this SuccessResult.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.ocient.util.CompletableFutures.Result
equals, isException, isSuccess, mapSuccess, recoverMethods inherited from interface com.ibm.asyncutil.util.Either
flatMap, forEach, left, map, map, right
-
Field Details
-
item
-
-
Constructor Details
-
SuccessResult
Constructs a new SuccessResult with the given value.- Parameters:
item- the success value of the result
-
-
Method Details
-
isLeft
public boolean isLeft() -
isRight
public boolean isRight() -
get
Description copied from interface:CompletableFutures.ResultReturns the success result reason. If this Result represents an error, the fail cause is thrown.- Specified by:
getin interfaceCompletableFutures.Result<T,E extends Exception> - Returns:
- the fail cause
-
orElseThrow
Description copied from interface:CompletableFutures.ResultReturns the success value of this Result. If this Result represents an error, an IllegalStateException is thrown.- Specified by:
orElseThrowin interfaceCompletableFutures.Result<T,E extends Exception> - Returns:
- the success value
-
getException
Description copied from interface:CompletableFutures.ResultReturns the fail cause. If this Result represents success, anSQLStates.OKis returned.- Specified by:
getExceptionin interfaceCompletableFutures.Result<T,E extends Exception> - Returns:
- the fail cause or
SQLStates.OKif success
-
fold
Applies the given functions to the success value and theException, respectively, and returns the result of applying the success value function. -
hashCode
public int hashCode() -
equals
-
toString
Returns a string representation of this SuccessResult.
-