Package com.yubico.yubikit.core.util
Class Result<T,E extends Throwable> 
java.lang.Object
com.yubico.yubikit.core.util.Result<T,E> 
- Type Parameters:
- T- the type of the wrapped value
- E- the type of the exception thrown
Result value, wrapping a T (if successful) or an Exception (if failed).
- 
Method SummaryModifier and TypeMethodDescriptionfailure(E error) Constructs a Result for an Exception (failure).getValue()Gets the held value, if the Result is successful, or throws the error on failure.booleanisError()Checks if the Result is a failure.booleanChecks if the Result is successful.Runs the given callable, creating a Result of its value, if run successfully, or its Exception.success(T value) Constructs a Result for a value (success).
- 
Method Details- 
getValueGets the held value, if the Result is successful, or throws the error on failure.- Returns:
- the held value on success
- Throws:
- E- the held exception on failure
 
- 
isSuccesspublic boolean isSuccess()Checks if the Result is successful.
- 
isErrorpublic boolean isError()Checks if the Result is a failure.
- 
successConstructs a Result for a value (success).- Parameters:
- value- the value to hold
 
- 
failureConstructs a Result for an Exception (failure).- Parameters:
- error- the error to hold
 
- 
ofRuns the given callable, creating a Result of its value, if run successfully, or its Exception.- Parameters:
- call- callable to invoke, resulting in a value
 
 
-