Result (Apache Geode 2.0.2)
Description: declaration: package: org.apache.geode.services.result, interface: Result

Package org.apache.geode.services.result

# Interface Result<SuccessType,FailureType>

Type Parameters:
  `SuccessType` - the return type in the event of operational success
  `FailureType` - the return type in the event of operational failure

All Known Subinterfaces:
  `ServiceResult<SuccessType>`

All Known Implementing Classes:
  `Failure`, `Success`

@Experimental public interface Result<SuccessType,FailureType>
The `Result` type is an attempt at the function construct of * Either. In this implementation a `Result` * can define either success or failure (error) using the same type.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `FailureType`
  `getErrorMessage()`
  The return message of a failed operation.
  `SuccessType`
  `getMessage()`
  The return message of a successful operation.
  `default boolean`
  `isFailure()`
  Returns a boolean to indicate the success or failure of the operation
  `default boolean`
  `isSuccessful()`
  Returns a boolean to indicate the success or failure of the operation
  `<T> T`
  `map(Function<SuccessType,T> successFunction, Function<FailureType,T> errorFunction)`
  A mapping function that maps to either `SuccessType` or `FailureType` depending on success or failure of the operation.

- ## Method Details

  - ### map

    <T> T map(Function<SuccessType,T> successFunction, Function<FailureType,T> errorFunction)
    A mapping function that maps to either `SuccessType` or `FailureType` depending on success or failure of the operation.
    Type Parameters:
      `T` - the resultant type
    Parameters:
      `successFunction` - the mapping function to map the SuccessType to the resultant type
      `errorFunction` - the mapping function to map the FailureType to the resultant error type
    Returns:
      result of type `T`

  - ### getMessage

    SuccessType getMessage()
    The return message of a successful operation. The return type is of type `SuccessType`
    Returns:
      the result of the operation

  - ### getErrorMessage

    FailureType getErrorMessage()
    The return message of a failed operation. The return type is of type `FailureType`
    Returns:
      the failure message of why the operation did not succeed.

  - ### isSuccessful

    default boolean isSuccessful()
    Returns a boolean to indicate the success or failure of the operation
    Returns:
      true indicating the success of the operation

  - ### isFailure

    default boolean isFailure()
    Returns a boolean to indicate the success or failure of the operation
    Returns:
      true indicating the failure of the operation