Class Success<SuccessType>
java.lang.Object
org.apache.geode.services.result.impl.Success<SuccessType>
- Type Parameters:
SuccessType- the result type for a successful operation.
- All Implemented Interfaces:
Result<SuccessType,,String> ServiceResult<SuccessType>
This type of
ServiceResult represents a successful operation. It contains the
return value of type SuccessType- Since:
- 1.14.0
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionThe return message of a failed operation.The return message of a successful operation.ifSuccessful(Consumer<? super SuccessType> consumer) Executes the providedConsumerif thisServiceResultis a success.booleanReturns a boolean to indicate the success or failure of the operation<T> Tmap(Function<SuccessType, T> successFunction, Function<String, T> errorFunction) A mapping function that maps to eitherSuccessTypeorFailureTypedepending on success or failure of the operation.static <T> Success<T>of(T result) Creates aSuccessobject containing the errorMessageMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.geode.services.result.ServiceResult
ifFailure
-
Field Details
-
SUCCESS_TRUE
-
-
Method Details
-
of
Creates aSuccessobject containing the errorMessage- Type Parameters:
T- the type of the result- Parameters:
result- the return value of the successful operation- Returns:
- a
Successinstance containing the return value
-
map
Description copied from interface:ResultA mapping function that maps to eitherSuccessTypeorFailureTypedepending on success or failure of the operation.- Specified by:
mapin interfaceResult<SuccessType,String> - Specified by:
mapin interfaceServiceResult<SuccessType>- 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
Description copied from interface:ResultThe return message of a successful operation. The return type is of typeSuccessType- Specified by:
getMessagein interfaceResult<SuccessType,String> - Specified by:
getMessagein interfaceServiceResult<SuccessType>- Returns:
- the result of the operation
-
getErrorMessage
Description copied from interface:ResultThe return message of a failed operation. The return type is of typeFailureType- Specified by:
getErrorMessagein interfaceResult<SuccessType,String> - Specified by:
getErrorMessagein interfaceServiceResult<SuccessType>- Returns:
- the failure message of why the operation did not succeed.
-
isSuccessful
public boolean isSuccessful()Description copied from interface:ResultReturns a boolean to indicate the success or failure of the operation- Specified by:
isSuccessfulin interfaceResult<SuccessType,String> - Returns:
- true indicating the success of the operation
-
ifSuccessful
Description copied from interface:ServiceResultExecutes the providedConsumerif thisServiceResultis a success.- Specified by:
ifSuccessfulin interfaceServiceResult<SuccessType>- Parameters:
consumer- theConsumerto be executed on success.- Returns:
- this
ServiceResult
-