Class StatusInfo
java.lang.Object
org.eclipse.ditto.internal.utils.health.StatusInfo
- All Implemented Interfaces:
org.eclipse.ditto.base.model.json.Jsonifiable<org.eclipse.ditto.json.JsonObject>
@Immutable
public final class StatusInfo
extends Object
implements org.eclipse.ditto.base.model.json.Jsonifiable<org.eclipse.ditto.json.JsonObject>
Contains the
status and a detail in case the Status was not StatusInfo.Status.UP of a
single health "entry".-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAn enumeration of status codes for the health status in the style of spring boot actuator.Nested classes/interfaces inherited from interface org.eclipse.ditto.base.model.json.Jsonifiable
org.eclipse.ditto.base.model.json.Jsonifiable.WithFieldSelector, org.eclipse.ditto.base.model.json.Jsonifiable.WithFieldSelectorAndPredicate<T extends Object>, org.eclipse.ditto.base.model.json.Jsonifiable.WithPointer<J extends org.eclipse.ditto.json.JsonValue>, org.eclipse.ditto.base.model.json.Jsonifiable.WithPredicate<J extends org.eclipse.ditto.json.JsonValue,T extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.eclipse.ditto.json.JsonFieldDefinition<org.eclipse.ditto.json.JsonArray>JSON field of the children (sub-statuses).static final org.eclipse.ditto.json.JsonFieldDefinition<org.eclipse.ditto.json.JsonArray>JSON field of the detailed status messages.static final org.eclipse.ditto.json.JsonFieldDefinition<String>JSON field of the label.static final org.eclipse.ditto.json.JsonFieldDefinition<String>JSON field of the status. -
Method Summary
Modifier and TypeMethodDescriptionaddDetail(StatusDetailMessage detail) static StatusInfocomposite(List<StatusInfo> children) Returns a newStatusInfoinstance with the specifiedchildren.static StatusInfocomposite(Map<String, StatusInfo> labeledChildren) Returns a newStatusInfoinstance with the specifiedlabeledChildren.booleanstatic StatusInfofromDetail(StatusDetailMessage detail) Returns a newStatusInfoinstance with the specifieddetail.static StatusInfofromDetails(Collection<StatusDetailMessage> details) Returns a newStatusInfoinstance with the specifieddetails.static StatusInfoCreates a newStatusInfofrom a JSON string.static StatusInfofromJson(org.eclipse.ditto.json.JsonObject jsonObject) Creates a newStatusInfofrom a JSON object.static StatusInfofromStatus(StatusInfo.Status status) Returns a newStatusInfoinstance with the specifiedstatus.static StatusInfofromStatus(StatusInfo.Status status, String message) Returns a newStatusInfoinstance with the specifiedstatusandmessage.static StatusInfofromStatus(StatusInfo.Status status, Collection<StatusDetailMessage> details) Returns a newStatusInfoinstance with the specifiedstatusanddetails.Returns the children.Returns the details.getLabel()Returns the (optional) label.Returns theStatus.inthashCode()booleanReturns whether this instance is a composite, i.e.booleanReturns whether this status is considered as healthy.Creates a copy of this instance with the givenlabelas label.org.eclipse.ditto.json.JsonObjecttoJson()toString()static StatusInfounknown()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.ditto.base.model.json.Jsonifiable
getImplementedSchemaVersion, getLatestSchemaVersion, getSupportedSchemaVersions, implementsSchemaVersion, implementsSchemaVersion, toJsonString
-
Field Details
-
JSON_KEY_LABEL
JSON field of the label. -
JSON_KEY_STATUS
JSON field of the status. -
JSON_KEY_DETAILS
public static final org.eclipse.ditto.json.JsonFieldDefinition<org.eclipse.ditto.json.JsonArray> JSON_KEY_DETAILSJSON field of the detailed status messages. -
JSON_KEY_CHILDREN
public static final org.eclipse.ditto.json.JsonFieldDefinition<org.eclipse.ditto.json.JsonArray> JSON_KEY_CHILDRENJSON field of the children (sub-statuses).
-
-
Method Details
-
unknown
- Returns:
- the StatusInfo instance.
-
fromStatus
Returns a newStatusInfoinstance with the specifiedstatus.- Parameters:
status- the status.- Returns:
- the StatusInfo instance.
-
fromStatus
Returns a newStatusInfoinstance with the specifiedstatusandmessage.- Parameters:
status- the status.message- the message.- Returns:
- the StatusInfo instance.
-
fromStatus
public static StatusInfo fromStatus(StatusInfo.Status status, Collection<StatusDetailMessage> details) Returns a newStatusInfoinstance with the specifiedstatusanddetails.- Parameters:
status- the status.details- the details.- Returns:
- the StatusInfo instance.
-
fromDetail
Returns a newStatusInfoinstance with the specifieddetail. The status will be computed.- Parameters:
detail- the detail.- Returns:
- the StatusInfo instance.
-
fromDetails
Returns a newStatusInfoinstance with the specifieddetails. The status will be computed.- Parameters:
details- the detail.- Returns:
- the StatusInfo instance.
-
composite
Returns a newStatusInfoinstance with the specifiedchildren. The composite status will be computed based on the children's statuses.- Parameters:
children- the children.- Returns:
- the StatusInfo instance.
-
composite
Returns a newStatusInfoinstance with the specifiedlabeledChildren. The map's key will label theStatusInfovalues. The composite status will be computed based on the children's statuses.- Parameters:
labeledChildren- the children.- Returns:
- the StatusInfo instance.
-
fromJson
Creates a newStatusInfofrom a JSON string.- Parameters:
jsonString- the JSON string.- Returns:
- the created instance.
- Throws:
NullPointerException- ifjsonStringisnull.IllegalArgumentException- ifjsonStringis empty.org.eclipse.ditto.json.JsonParseException- if the passed injsonStringdoes not contain a JSON object or if it is not valid JSON.org.eclipse.ditto.json.JsonMissingFieldException- if the passed injsonObjectwas not in the expected format.
-
fromJson
Creates a newStatusInfofrom a JSON object.- Parameters:
jsonObject- the JSON object.- Returns:
- the created instance.
- Throws:
NullPointerException- ifjsonObjectisnull.IllegalArgumentException- ifjsonObjectis empty.org.eclipse.ditto.json.JsonMissingFieldException- if the passed injsonObjectwas not in the expected format.
-
getStatus
Returns theStatus.- Returns:
- the status.
-
getDetails
Returns the details.- Returns:
- the details, which may be empty.
-
getChildren
Returns the children.- Returns:
- the children, which may be empty.
- See Also:
-
getLabel
Returns the (optional) label.- Returns:
- the (optional) label.
-
label
Creates a copy of this instance with the givenlabelas label.- Parameters:
label- the label, may benull.- Returns:
- the labeled copy.
-
isComposite
public boolean isComposite()Returns whether this instance is a composite, i.e. whether it has children.- Returns:
- whether this instance is a composite.
- See Also:
-
addDetail
Creates a newStatusInfofrom thisStatusInfo, extended with the specifieddetail. Note that adding an error detail might change theStatusInfo's status.- Parameters:
detail- the detail.- Returns:
- the StatusInfo instance.
-
isHealthy
public boolean isHealthy()Returns whether this status is considered as healthy.- Returns:
true, when healthy;false, otherwise.
-
toJson
public org.eclipse.ditto.json.JsonObject toJson()- Specified by:
toJsonin interfaceorg.eclipse.ditto.base.model.json.Jsonifiable<org.eclipse.ditto.json.JsonObject>
-
hashCode
public int hashCode() -
equals
-
toString
-