Class Health.Builder
java.lang.Object
org.springframework.boot.actuate.health.Health.Builder
- Enclosing class:
- Health
Builder for creating immutable
Health
instances.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Create a newHealth
instance with the previously specified code and details.down()
Set status toStatus.DOWN
.Set status toStatus.DOWN
and add details for givenThrowable
.Set status toStatus.OUT_OF_SERVICE
.Set status to givenstatusCode
.Set status to givenStatus
instance.unknown()
Set status toStatus.UNKNOWN
status.up()
Set status toStatus.UP
status.withDetail
(String key, Object value) Record detail using givenkey
andvalue
.withDetails
(Map<String, ?> details) Record details from the givendetails
map.Record detail for givenException
.
-
Constructor Details
-
Builder
public Builder()Create new Builder instance. -
Builder
Create new Builder instance, setting status to givenstatus
.- Parameters:
status
- theStatus
to use
-
Builder
Create new Builder instance, setting status to givenstatus
and details to givendetails
.
-
-
Method Details
-
withException
Record detail for givenException
.- Parameters:
ex
- the exception- Returns:
- this
Health.Builder
instance
-
withDetail
Record detail using givenkey
andvalue
.- Parameters:
key
- the detail keyvalue
- the detail value- Returns:
- this
Health.Builder
instance
-
withDetails
Record details from the givendetails
map. Keys from the given map replace any existing keys if there are duplicates.- Parameters:
details
- map of details- Returns:
- this
Health.Builder
instance - Since:
- 2.1.0
-
unknown
Set status toStatus.UNKNOWN
status.- Returns:
- this
Health.Builder
instance
-
up
Set status toStatus.UP
status.- Returns:
- this
Health.Builder
instance
-
down
Set status toStatus.DOWN
and add details for givenThrowable
.- Parameters:
ex
- the exception- Returns:
- this
Health.Builder
instance
-
down
Set status toStatus.DOWN
.- Returns:
- this
Health.Builder
instance
-
outOfService
Set status toStatus.OUT_OF_SERVICE
.- Returns:
- this
Health.Builder
instance
-
status
Set status to givenstatusCode
.- Parameters:
statusCode
- the status code- Returns:
- this
Health.Builder
instance
-
status
Set status to givenStatus
instance.- Parameters:
status
- the status- Returns:
- this
Health.Builder
instance
-
build
Create a newHealth
instance with the previously specified code and details.- Returns:
- a new
Health
instance
-