Class Status
java.lang.Object
ch.systemsx.cisd.common.exceptions.Status
- Direct Known Subclasses:
StatusWithResult
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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Statusstatic StatuscreateError(boolean retriable) Create an error.static StatuscreateError(boolean retriable, String message) static StatuscreateError(String message) static StatuscreateError(String messageTemplate, Object... args) static Statusstatic StatuscreateRetriableError(String message) static StatuscreateRetriableError(String messageTemplate, Object... args) booleanprotected static StatusFlaggetErrorFlag(boolean retriable) getFlag()inthashCode()final booleanisError()final booleanfinal booleanisOK()final booleantoString()
-
Field Details
-
OK
The status indicating that the operation went fine.
-
-
Constructor Details
-
Status
-
-
Method Details
-
createError
Create an error.- Parameters:
retriable- Iftrue, the error will be marked 'retriable'.
-
createError
-
createError
-
createError
-
createError
-
createRetriableError
-
createRetriableError
-
createRetriableError
-
getErrorFlag
-
getFlag
- Returns:
- The status flag of the operation.
-
isOK
public final boolean isOK()- Returns:
trueif this status represents an OK status.
-
isError
public final boolean isError()- Returns:
trueif this status represents an error.
-
isRetriableError
public final boolean isRetriableError()- Returns:
trueif this status represents an error where it makes sense to retry the operation.
-
isNonRetriableError
public final boolean isNonRetriableError()- Returns:
trueif this status represents an error where it does not make sense to retry the operation.
-
tryGetErrorMessage
- Returns:
- The error message of the operation if
getFlag() != OK(can be empty), ornullotherwise.
-
equals
-
hashCode
public int hashCode() -
toString
-