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