Package com.digimarc.dms.core
Class OperationResult<Success,Error>
java.lang.Object
com.digimarc.dms.core.OperationResult<Success,Error>
- Type Parameters:
Success
- Type of success valueError
- Type of error value
Encapsulates a successful outcome with a value of type Success or a error with an arbitrary error of type Error.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <Error> OperationResult
error
(Error code) Returns an instance that encapsulates the given value as error value.getError()
Returns the encapsulated error if this instance represents error or null if it is success.Returns the encapsulated success value if this instance represents success or null if it is error.boolean
Returns true if this instance represents a successful outcome.static <Success> OperationResult
success
(Success result) Returns an instance that encapsulates the given value as successful value.
-
Method Details
-
success
Returns an instance that encapsulates the given value as successful value.- Type Parameters:
Success
- type of success value- Parameters:
result
- success value- Returns:
- OperationResult instance with encapsulated {result} in success
-
error
Returns an instance that encapsulates the given value as error value.- Type Parameters:
Error
- type of error value- Parameters:
code
- error value- Returns:
- OperationResult instance with encapsulated {code} in error
-
isSuccessful
public boolean isSuccessful()Returns true if this instance represents a successful outcome.- Returns:
-
getResult
Returns the encapsulated success value if this instance represents success or null if it is error.- Returns:
- success value
-
getError
Returns the encapsulated error if this instance represents error or null if it is success.- Returns:
-