|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.bamboo.utils.fage.Result<E,T>
E
- exception typeT
- result typepublic class Result<E extends java.lang.Throwable,T>
Formalized encapsulation of Either to return either result or exception.
Method Summary | ||
---|---|---|
static
|
exception(E exception)
Create Result object with exception object |
|
E |
getException()
Return exception object if Result object was created with one. |
|
T |
getResult()
Return valid result object if Result object was created with one. |
|
T |
getResult(T defaultValue)
|
|
T |
getResultThrowException()
|
|
boolean |
hasException()
Test if Result object holds an exception |
|
static
|
result(T result)
Create Result object with valid result object |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public boolean hasException()
Result
object holds an exception
Result
object holds an exceptionpublic T getResult()
Result
object was created with one.
java.util.NoSuchElementException
- if Result
object was created with exception@Nullable public T getResult(@Nullable T defaultValue)
public E getException()
Result
object was created with one.
java.util.NoSuchElementException
- if Result
object was created with valid resultpublic T getResultThrowException() throws E extends java.lang.Throwable
E extends java.lang.Throwable
public static <E extends java.lang.Throwable,T> Result<E,T> result(T result)
Result
object with valid result object
E
- exception typeT
- valid result typeresult
- valid result object
Result
objectpublic static <E extends java.lang.Throwable,T> Result<E,T> exception(E exception)
Result
object with exception object
E
- exception typeT
- valid result typeexception
- exception object
Result
object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |