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
Modifier and Type
Field
Description
`protected final T`
`item`

## Constructor Summary

Constructors
Constructor
Description
`SuccessResult(T item)`
Constructs a new SuccessResult with the given value.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object obj)`
`<V> V`
`fold(Function<? super T,? extends V> leftFn, Function<? super E,? extends V> rightFn)`
Applies the given functions to the success value and the `Exception`, respectively, and returns the result of applying the success value function.
`T`
`get()`
Returns the success result reason.
`E`
`getException()`
Returns the fail cause.
`int`
`hashCode()`
`boolean`
`isLeft()`
`boolean`
`isRight()`
`T`
`orElseThrow()`
Returns the success value of this Result.
`String`
`toString()`
Returns a string representation of this SuccessResult.

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface com.ocient.util.CompletableFutures.Result

`equals, isException, isSuccess, mapSuccess, recover`

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

`flatMap, forEach, left, map, map, right`

## Field Details

### item

protected final T item

## Constructor Details

### SuccessResult

public SuccessResult(T item)
Constructs a new SuccessResult with the given value.

Parameters:
  `item` - the success value of the result

## Method Details

### isLeft

public boolean isLeft()

Specified by:
  `isLeft` in interface `com.ibm.asyncutil.util.Either<T,E extends Exception>`

### isRight

public boolean isRight()

Specified by:
  `isRight` in interface `com.ibm.asyncutil.util.Either<T,E extends Exception>`

### get

public T get()
Description copied from interface: `CompletableFutures.Result`
Returns the success result reason. If this Result represents an error, the fail cause is thrown.

Specified by:
  `get` in interface `CompletableFutures.Result<T,E extends Exception>`
Returns:
  the fail cause

### orElseThrow

public T orElseThrow()
Description copied from interface: `CompletableFutures.Result`
Returns the success value of this Result. If this Result represents an error, an IllegalStateException is thrown.

Specified by:
  `orElseThrow` in interface `CompletableFutures.Result<T,E extends Exception>`
Returns:
  the success value

### getException

public E 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,E extends Exception>`
Returns:
  the fail cause or `SQLStates.OK` if success

### fold

public <V> V fold(Function<? super T,? extends V> leftFn, Function<? super E,? extends V> rightFn)
Applies the given functions to the success value and the `Exception`, respectively, and returns the result of applying the success value function.

Specified by:
  `fold` in interface `com.ibm.asyncutil.util.Either<T,E extends Exception>`
Parameters:
  `leftFn` - the function to apply to the success value
  `rightFn` - the function to apply to the `Exception` (unused in this case)
Returns:
  the result of applying the success value function

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### equals

public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`

### toString

public String toString()
Returns a string representation of this SuccessResult.

Overrides:
  `toString` in class `Object`
Returns:
  a string representation of this SuccessResult, in the format "[item]", where "item" is the string representation of the success value