Package org.eclipse.microprofile.health
Class HealthCheckResponseBuilder
- java.lang.Object
-
- org.eclipse.microprofile.health.HealthCheckResponseBuilder
-
public abstract class HealthCheckResponseBuilder extends java.lang.Object
A builder to construct a health check procedure response.The
HealthCheckResponseBuilder
class is reserved for an extension by implementation providers.
-
-
Constructor Summary
Constructors Constructor Description HealthCheckResponseBuilder()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract HealthCheckResponse
build()
Creates aHealthCheckResponse
from the current builder.abstract HealthCheckResponseBuilder
down()
Sets the status of the health check response toHealthCheckResponse.State.DOWN
.abstract HealthCheckResponseBuilder
name(java.lang.String name)
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
withData(java.lang.String key, boolean value)
Adds additional boolean data to the health check response.abstract HealthCheckResponseBuilder
withData(java.lang.String key, long value)
Adds additional numeric data to the health check response.abstract HealthCheckResponseBuilder
withData(java.lang.String key, java.lang.String value)
Adds additional string data to the health check response.
-
-
-
Method Detail
-
name
public abstract HealthCheckResponseBuilder name(java.lang.String 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
public abstract HealthCheckResponseBuilder withData(java.lang.String key, java.lang.String value)
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
public abstract HealthCheckResponseBuilder withData(java.lang.String key, long value)
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
public abstract HealthCheckResponseBuilder withData(java.lang.String key, boolean value)
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
public abstract HealthCheckResponseBuilder up()
Sets the status of the health check response toHealthCheckResponse.State.UP
. This implies that the health check was successful.- Returns:
- this builder
-
down
public abstract HealthCheckResponseBuilder 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
public abstract HealthCheckResponseBuilder state(boolean up)
Sets the status of the health check response according to the boolean valueup
.- Parameters:
up
- the status- Returns:
- this builder
-
build
public abstract HealthCheckResponse build()
Creates aHealthCheckResponse
from the current builder.- Returns:
- A new
HealthCheckResponse
defined by this builder
-
-