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) CreateResult
object with exception objectReturn exception object ifResult
object was created with one.Return valid result object ifResult
object was created with one.boolean
Test ifResult
object holds an exceptionresult
(T result) CreateResult
object with valid result object
-
Method Details
-
hasException
public boolean hasException()Test ifResult
object holds an exception- Returns:
- true if this
Result
object holds an exception
-
getResult
Return valid result object ifResult
object was created with one.- Returns:
- valid result object
- Throws:
NoSuchElementException
- ifResult
object was created with exception
-
getResult
-
getException
Return exception object ifResult
object was created with one.- Returns:
- exception object
- Throws:
NoSuchElementException
- ifResult
object was created with valid result
-
getResultThrowException
-
result
CreateResult
object with valid result object- Type Parameters:
E
- exception typeT
- valid result type- Parameters:
result
- valid result object- Returns:
Result
object
-
exception
CreateResult
object with exception object- Type Parameters:
E
- exception typeT
- valid result type- Parameters:
exception
- exception object- Returns:
Result
object
-