@Introspected public class HealthStatus extends Object implements 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 String |
NAME_DOWN
The default name to use for an
DOWN status. |
static 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 String name) |
HealthStatus(String name,
String description,
Boolean operational,
Integer severity) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(HealthStatus o)
Sorts statuses in order of "functioning level".
|
HealthStatus |
describe(String description)
Describe an existing
HealthStatus . |
boolean |
equals(Object o) |
Optional<String> |
getDescription() |
String |
getName() |
Optional<Boolean> |
getOperational()
Whether the status represents a functioning service.
|
Optional<Integer> |
getSeverity()
The severity of the status.
|
int |
hashCode() |
String |
toString() |
public static final String NAME_UP
UP
status.public static final String NAME_DOWN
DOWN
status.public static final HealthStatus UP
public static final HealthStatus DOWN
public static final HealthStatus UNKNOWN
public HealthStatus(String name, String description, Boolean operational, 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 describe(String description)
HealthStatus
.description
- The descriptionpublic String getName()
public Optional<Boolean> getOperational()
public Optional<Integer> getSeverity()
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 Comparable<HealthStatus>
o
- The status to compare