ch.systemsx.cisd.common.exceptions
Class StatusWithResult<T>

java.lang.Object
  extended by ch.systemsx.cisd.common.exceptions.Status
      extended by ch.systemsx.cisd.common.exceptions.StatusWithResult<T>

public class StatusWithResult<T>
extends Status

A Status that can also hold a result.


Field Summary
 
Fields inherited from class ch.systemsx.cisd.common.exceptions.Status
OK
 
Method Summary
static
<T> StatusWithResult<T>
create(T resultOrNull)
          Creates a new result with status StatusFlag.OK and resultOrNull.
static
<T> StatusWithResult<T>
createError()
           
static
<T> StatusWithResult<T>
createError(boolean retriable)
          Create an error.
static
<T> StatusWithResult<T>
createError(boolean retriable, java.lang.String message)
           
static
<T> StatusWithResult<T>
createError(java.lang.String message)
           
static
<T> StatusWithResult<T>
createRetriableError()
           
static
<T> StatusWithResult<T>
createRetriableError(java.lang.String message)
           
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 java.lang.String toString()
           
 T tryGetResult()
          Returns the result of the operation (may be null).
 
Methods inherited from class ch.systemsx.cisd.common.exceptions.Status
createError, createRetriableError, getFlag, isError, isNonRetriableError, isOK, isRetriableError, tryGetErrorMessage
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static <T> StatusWithResult<T> create(T resultOrNull)
Creates a new result with status StatusFlag.OK and resultOrNull.


createError

public static <T> StatusWithResult<T> createError(boolean retriable)
Create an error.

Parameters:
retriable - If true, the error will be marked 'retriable'.

createError

public static <T> StatusWithResult<T> createError(boolean retriable,
                                                  java.lang.String message)

createError

public static <T> StatusWithResult<T> createError()

createError

public static <T> StatusWithResult<T> createError(java.lang.String message)

createRetriableError

public static <T> StatusWithResult<T> createRetriableError()

createRetriableError

public static <T> StatusWithResult<T> createRetriableError(java.lang.String message)

tryGetResult

public final T tryGetResult()
Returns the result of the operation (may be null).


equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class Status

hashCode

public int hashCode()
Overrides:
hashCode in class Status

toString

public java.lang.String toString()
Overrides:
toString in class Status