Package org.apache.geode.services.result
Interface Result<SuccessType,FailureType>
- Type Parameters:
SuccessType- the return type in the event of operational successFailureType- the return type in the event of operational failure
- All Known Subinterfaces:
ServiceResult<SuccessType>
@Experimental
public interface Result<SuccessType,FailureType>
-
Method Summary
Modifier and TypeMethodDescriptionThe return message of a failed operation.The return message of a successful operation.default booleanReturns a boolean to indicate the success or failure of the operationdefault booleanReturns a boolean to indicate the success or failure of the operation<T> Tmap(Function<SuccessType, T> successFunction, Function<FailureType, T> errorFunction) A mapping function that maps to eitherSuccessTypeorFailureTypedepending on success or failure of the operation.
-
Method Details
-
map
A mapping function that maps to eitherSuccessTypeorFailureTypedepending 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 typeerrorFunction- 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 typeSuccessType- Returns:
- the result of the operation
-
getErrorMessage
FailureType getErrorMessage()The return message of a failed operation. The return type is of typeFailureType- 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
-