ch.systemsx.cisd.common.exceptions
Class Status
java.lang.Object
ch.systemsx.cisd.common.exceptions.Status
- Direct Known Subclasses:
- StatusWithResult
public class Status
- extends java.lang.Object
A class that holds the information about the status of an operation. To be used whenever a
failure of an operation is signalled back via a return value rather than an exception.
Field Summary |
static Status |
OK
The status indicating that the operation went fine. |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
OK
public static final Status OK
- The status indicating that the operation went fine.
createError
public static Status createError(boolean retriable)
- Create an error.
- Parameters:
retriable
- If true
, the error will be marked 'retriable'.
createError
public static Status createError(boolean retriable,
java.lang.String message)
createError
public static Status createError()
createError
public static Status createError(java.lang.String message)
createError
public static Status createError(java.lang.String messageTemplate,
java.lang.Object... args)
createRetriableError
public static Status createRetriableError()
createRetriableError
public static Status createRetriableError(java.lang.String message)
createRetriableError
public static Status createRetriableError(java.lang.String messageTemplate,
java.lang.Object... args)
getFlag
public StatusFlag getFlag()
- Returns:
- The status flag of the operation.
isOK
public final boolean isOK()
- Returns:
true
if this status represents an OK status.
isError
public final boolean isError()
- Returns:
true
if this status represents an error.
isRetriableError
public final boolean isRetriableError()
- Returns:
true
if this status represents an error where it makes sense to retry
the operation.
isNonRetriableError
public final boolean isNonRetriableError()
- Returns:
true
if this status represents an error where it does not make sense to
retry the operation.
tryGetErrorMessage
public java.lang.String tryGetErrorMessage()
- Returns:
- The error message of the operation if
getFlag() != OK
(can be empty), or
null
otherwise.
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object