Package org.eclipse.microprofile.health
Class HealthCheckResponseBuilder
java.lang.Object
org.eclipse.microprofile.health.HealthCheckResponseBuilder
A builder to construct a health check procedure response.
The HealthCheckResponseBuilder
class is reserved for an extension by implementation providers.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract HealthCheckResponse
build()
Creates aHealthCheckResponse
from the current builder.abstract HealthCheckResponseBuilder
down()
Sets the status of the health check response toHealthCheckResponse.State.DOWN
.abstract HealthCheckResponseBuilder
Sets the name of the health check response.abstract HealthCheckResponseBuilder
state
(boolean up) Sets the status of the health check response according to the boolean valueup
.abstract HealthCheckResponseBuilder
up()
Sets the status of the health check response toHealthCheckResponse.State.UP
.abstract HealthCheckResponseBuilder
Adds additional boolean data to the health check response.abstract HealthCheckResponseBuilder
Adds additional numeric data to the health check response.abstract HealthCheckResponseBuilder
Adds additional string data to the health check response.
-
Constructor Details
-
HealthCheckResponseBuilder
public HealthCheckResponseBuilder()
-
-
Method Details
-
name
Sets the name of the health check response. Note: The health check response name is required and needs to be set before the response is constructed.- Parameters:
name
- The health check response name- Returns:
- this builder
-
withData
Adds additional string data to the health check response. Puts thevalue
identified bykey
to the data section of the health check response. Additional invocations of awithData
method with the samekey
override the key-value pair.- Parameters:
key
- the identifiervalue
- the value- Returns:
- this builder
-
withData
Adds additional numeric data to the health check response. Puts the longvalue
identified bykey
to the data section of the health check response. Additional invocations of awithData
method with the samekey
override the key-value pair.- Parameters:
key
- the identifiervalue
- the value- Returns:
- this builder
-
withData
Adds additional boolean data to the health check response. Puts the booleanvalue
identified bykey
to the data section of the health check response. Additional invocations of awithData
method with the samekey
override the key-value pair.- Parameters:
key
- the identifiervalue
- the value- Returns:
- this builder
-
up
Sets the status of the health check response toHealthCheckResponse.State.UP
. This implies that the health check was successful.- Returns:
- this builder
-
down
Sets the status of the health check response toHealthCheckResponse.State.DOWN
. This implies that the health check was not successful.- Returns:
- this builder
-
state
Sets the status of the health check response according to the boolean valueup
.- Parameters:
up
- the status- Returns:
- this builder
-
build
Creates aHealthCheckResponse
from the current builder.- Returns:
- A new
HealthCheckResponse
defined by this builder
-