| Modifier | Constructor and Description | 
|---|---|
protected  | 
Result(E error)  | 
protected  | 
Result(T result)  | 
| Modifier and Type | Method and Description | 
|---|---|
static <T,E extends Exception> | 
error(E error)
Constructs an unsuccessful result. 
 | 
T | 
get()
Returns the value if successful, throws the error is not. 
 | 
E | 
getError()
Returns the error if unsuccessful. 
 | 
T | 
getSuccess()
Returns the value if successful. 
 | 
boolean | 
isError()
Returns if the result is an error 
 | 
boolean | 
isSuccess()
Returns if the result is successful 
 | 
static <T,E extends Exception> | 
success(T value)
Constructs a successful result. 
 | 
public static <T,E extends Exception> Result<T,E> success(T value)
T - the value typeE - the error typevalue - the successful valuepublic static <T,E extends Exception> Result<T,E> error(E error)
T - the value typeE - the error typeerror - the errorpublic boolean isSuccess()
public boolean isError()
public T get() throws E extends Exception
public T getSuccess()
IllegalStateException - thrown if the result was not successfulpublic E getError()
IllegalStateException - thrown if the result was not an errorCopyright © 2011–2014. All rights reserved.