Package com.atlassian.bamboo.utils.fage
Class Result<E extends Throwable,T>
- java.lang.Object
-
- com.atlassian.bamboo.utils.fage.Result<E,T>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <E extends Throwable,T>
Result<E,T>exception(E exception)
CreateResult
object with exception objectE
getException()
Return exception object ifResult
object was created with one.T
getResult()
Return valid result object ifResult
object was created with one.T
getResult(T defaultValue)
T
getResultThrowException()
boolean
hasException()
Test ifResult
object holds an exceptionstatic <E extends Throwable,T>
Result<E,T>result(T result)
CreateResult
object with valid result object
-
-
-
Method Detail
-
hasException
public boolean hasException()
Test ifResult
object holds an exception- Returns:
- true if this
Result
object holds an exception
-
getResult
public T getResult()
Return valid result object ifResult
object was created with one.- Returns:
- valid result object
- Throws:
NoSuchElementException
- ifResult
object was created with exception
-
getException
public E getException()
Return exception object ifResult
object was created with one.- Returns:
- exception object
- Throws:
NoSuchElementException
- ifResult
object was created with valid result
-
result
public static <E extends Throwable,T> Result<E,T> result(T result)
CreateResult
object with valid result object- Type Parameters:
E
- exception typeT
- valid result type- Parameters:
result
- valid result object- Returns:
Result
object
-
-