Class Status

java.lang.Object
io.vertx.ext.healthchecks.Status

public class Status extends Object
Represents the outcome of a health check procedure. Each procedure produces a Status indicating either OK or KO. Optionally, it can also provide additional data.
Author:
Clement Escoffier
  • Constructor Details

    • Status

      public Status()
      Creates a new instance of Status with default values.
    • Status

      public Status(Status other)
      Creates a new instance of Status by copying the given Status.
      Parameters:
      other - the status to copy, must not be null
    • Status

      public Status(JsonObject json)
      Creates a new instance of Status from the given JSON structure.
      Parameters:
      json - the serialized form, must not be null
  • Method Details

    • OK

      public static Status OK()
      Creates a status when everything is fine.
      Returns:
      the created Status
    • OK

      public static Status OK(JsonObject data)
      Creates a status when everything is fine and adds metadata.
      Returns:
      the created Status
    • KO

      public static Status KO()
      Creates a status when something bad is detected.
      Returns:
      the created Status
    • KO

      public static Status KO(JsonObject data)
      Creates a status when something bad is detected. Also add some metadata.
      Returns:
      the created Status
    • toJson

      public JsonObject toJson()
      Builds the JSON representation of the current Status instance.
      Returns:
      the json object
    • isOk

      public boolean isOk()
      Returns:
      whether or not the current status is positive or negative.
    • setOk

      public Status setOk(boolean ok)
      Sets whether or not the current status is positive (UP) or negative (DOWN).
      Parameters:
      ok - true for UP, false for DOWN
      Returns:
      the current status
    • setKO

      public Status setKO()
      Sets the outcome of the status to KO.
      Returns:
      the current status
    • setOK

      public Status setOK()
      Sets the outcome of the status to OK.
      Returns:
      the current status
    • getData

      public JsonObject getData()
      Returns:
      the additional metadata.
    • setData

      public Status setData(JsonObject data)
      Sets the metadata.
      Parameters:
      data - the data
      Returns:
      the current status
    • isProcedureInError

      public boolean isProcedureInError()
      Returns:
      whether or not the status denotes a failure of a procedure.
    • setProcedureInError

      public Status setProcedureInError(boolean procedureInError)
      Sets whether or not the procedure attached to this status has failed (timeout, error...).
      Parameters:
      procedureInError - true if the procedure has not been completed correctly.
      Returns:
      the current status