@Immutable @Introspected public class HealthStatus extends java.lang.Object implements java.lang.Comparable<HealthStatus>
The status of a health indicator.
Modifier and Type | Field and Description |
---|---|
static HealthStatus |
DOWN
Indicates the service is down and unavailable.
|
static java.lang.String |
NAME_DOWN
The default name to use for an
DOWN status. |
static java.lang.String |
NAME_UP
The default name to use for an
UP status. |
static HealthStatus |
UNKNOWN
Indicates the service status is unknown.
|
static HealthStatus |
UP
Indicates the service is operational.
|
Constructor and Description |
---|
HealthStatus(@NotNull java.lang.String name) |
HealthStatus(java.lang.String name,
java.lang.String description,
java.lang.Boolean operational,
java.lang.Integer severity) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(HealthStatus o)
Sorts statuses in order of "functioning level".
|
HealthStatus |
describe(java.lang.String description)
Describe an existing
HealthStatus . |
boolean |
equals(java.lang.Object o) |
java.util.Optional<java.lang.String> |
getDescription() |
java.lang.String |
getName() |
java.util.Optional<java.lang.Boolean> |
getOperational()
Whether the status represents a functioning service.
|
java.util.Optional<java.lang.Integer> |
getSeverity()
The severity of the status.
|
int |
hashCode() |
java.lang.String |
toString() |
public static final java.lang.String NAME_UP
UP
status.public static final java.lang.String NAME_DOWN
DOWN
status.public static final HealthStatus UP
public static final HealthStatus DOWN
public static final HealthStatus UNKNOWN
public HealthStatus(java.lang.String name, java.lang.String description, java.lang.Boolean operational, java.lang.Integer severity)
name
- The name of the statusdescription
- The detailed information about the statusoperational
- If it's operationalseverity
- The severity, the higher the value, the more sever is situation.public HealthStatus(@NotNull @NotNull java.lang.String name)
name
- The name of the statuspublic HealthStatus describe(java.lang.String description)
HealthStatus
.description
- The descriptionpublic java.lang.String getName()
public java.util.Optional<java.lang.String> getDescription()
public java.util.Optional<java.lang.Boolean> getOperational()
public java.util.Optional<java.lang.Integer> getSeverity()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(HealthStatus o)
Operation is sorted (true, null, false). For statuses with matching operations, severity is sorted ascending, with nulls first.
compareTo
in interface java.lang.Comparable<HealthStatus>
o
- The status to comparepublic java.lang.String toString()
toString
in class java.lang.Object