public static final class HealthCheck.Result
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.lang.Throwable |
error |
private boolean |
healthy |
private static HealthCheck.Result |
HEALTHY |
private java.lang.String |
message |
Modifier | Constructor and Description |
---|---|
private |
HealthCheck.Result(boolean isHealthy,
java.lang.String message,
java.lang.Throwable error) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
java.lang.Throwable |
getError()
Returns any exception for the result, or
null if the result has
no exception. |
java.lang.String |
getMessage()
Returns any additional message for the result, or
null if the
result has no message. |
int |
hashCode() |
static HealthCheck.Result |
healthy() |
static HealthCheck.Result |
healthy(java.lang.String message)
Returns a healthy
HealthCheck.Result with an additional message. |
static HealthCheck.Result |
healthy(java.lang.String message,
java.lang.Object... args)
Returns a healthy
HealthCheck.Result with a formatted message. |
boolean |
isHealthy()
Returns
true if the result indicates the component is healthy;
false otherwise. |
java.lang.String |
toString() |
static HealthCheck.Result |
unhealthy(java.lang.String message)
Returns an unhealthy
HealthCheck.Result with the given message. |
static HealthCheck.Result |
unhealthy(java.lang.String message,
java.lang.Object... args)
Returns an unhealthy
HealthCheck.Result with a formatted message. |
static HealthCheck.Result |
unhealthy(java.lang.Throwable error)
Returns an unhealthy
HealthCheck.Result with the given error. |
private static final HealthCheck.Result HEALTHY
private final boolean healthy
private final java.lang.String message
private final java.lang.Throwable error
private HealthCheck.Result(boolean isHealthy, java.lang.String message, java.lang.Throwable error)
public static HealthCheck.Result healthy()
HealthCheck.Result
with no additional messagepublic static HealthCheck.Result healthy(java.lang.String message)
HealthCheck.Result
with an additional message.message
- an informative messageHealthCheck.Result
with an additional messagepublic static HealthCheck.Result healthy(java.lang.String message, java.lang.Object... args)
HealthCheck.Result
with a formatted message.
Message formatting follows the same rules as
String.format(String, Object...)
.message
- a message formatargs
- the arguments apply to the message formatHealthCheck.Result
with an additional messageString.format(String, Object...)
public static HealthCheck.Result unhealthy(java.lang.String message)
HealthCheck.Result
with the given message.message
- an informative message describing how the health check failedHealthCheck.Result
with the given messagepublic static HealthCheck.Result unhealthy(java.lang.String message, java.lang.Object... args)
HealthCheck.Result
with a formatted message.
Message formatting follows the same rules as
String.format(String, Object...)
.message
- a message formatargs
- the arguments apply to the message formatHealthCheck.Result
with an additional messageString.format(String, Object...)
public static HealthCheck.Result unhealthy(java.lang.Throwable error)
HealthCheck.Result
with the given error.error
- an exception thrown during the health checkHealthCheck.Result
with the given errorpublic boolean isHealthy()
true
if the result indicates the component is healthy;
false
otherwise.true
if the result indicates the component is healthypublic java.lang.String getMessage()
null
if the
result has no message.null
public java.lang.Throwable getError()
null
if the result has
no exception.null
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object