Package com.atlassian.bamboo.utils.fage
Class Result<E extends Throwable,T>
java.lang.Object
com.atlassian.bamboo.utils.fage.Result<E,T>
- Type Parameters:
E- exception typeT- result type
Formalized encapsulation of Either to return either result or exception.
-
Method Summary
Modifier and TypeMethodDescriptionexception(E exception) CreateResultobject with exception objectReturn exception object ifResultobject was created with one.Return valid result object ifResultobject was created with one.booleanTest ifResultobject holds an exceptionresult(T result) CreateResultobject with valid result object
-
Method Details
-
hasException
public boolean hasException()Test ifResultobject holds an exception- Returns:
- true if this
Resultobject holds an exception
-
getResult
Return valid result object ifResultobject was created with one.- Returns:
- valid result object
- Throws:
NoSuchElementException- ifResultobject was created with exception
-
getResult
-
getException
Return exception object ifResultobject was created with one.- Returns:
- exception object
- Throws:
NoSuchElementException- ifResultobject was created with valid result
-
getResultThrowException
-
result
CreateResultobject with valid result object- Type Parameters:
E- exception typeT- valid result type- Parameters:
result- valid result object- Returns:
Resultobject
-
exception
CreateResultobject with exception object- Type Parameters:
E- exception typeT- valid result type- Parameters:
exception- exception object- Returns:
Resultobject
-