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)CreateResultobject with exception objectEgetException()Return exception object ifResultobject was created with one.TgetResult()Return valid result object ifResultobject was created with one.TgetResult(T defaultValue)TgetResultThrowException()booleanhasException()Test ifResultobject holds an exceptionstatic <E extends Throwable,T>
Result<E,T>result(T result)CreateResultobject with valid result object
-
-
-
Method Detail
-
hasException
public boolean hasException()
Test ifResultobject holds an exception- Returns:
- true if this
Resultobject holds an exception
-
getResult
public T getResult()
Return valid result object ifResultobject was created with one.- Returns:
- valid result object
- Throws:
NoSuchElementException- ifResultobject was created with exception
-
getException
public E getException()
Return exception object ifResultobject was created with one.- Returns:
- exception object
- Throws:
NoSuchElementException- ifResultobject was created with valid result
-
result
public static <E extends Throwable,T> Result<E,T> result(T result)
CreateResultobject with valid result object- Type Parameters:
E- exception typeT- valid result type- Parameters:
result- valid result object- Returns:
Resultobject
-
-