Class Status

java.lang.Object
ch.systemsx.cisd.common.exceptions.Status
Direct Known Subclasses:
StatusWithResult

public class Status extends 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 Details

    • OK

      public static final Status OK
      The status indicating that the operation went fine.
  • Constructor Details

  • Method Details

    • 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, String message)
    • createError

      public static Status createError()
    • createError

      public static Status createError(String message)
    • createError

      public static Status createError(String messageTemplate, Object... args)
    • createRetriableError

      public static Status createRetriableError()
    • createRetriableError

      public static Status createRetriableError(String message)
    • createRetriableError

      public static Status createRetriableError(String messageTemplate, Object... args)
    • getErrorFlag

      protected static StatusFlag getErrorFlag(boolean retriable)
    • 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 String tryGetErrorMessage()
      Returns:
      The error message of the operation if getFlag() != OK (can be empty), or null otherwise.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object