Class SimpleCommandResponse
- java.lang.Object
-
- org.eclipse.ditto.services.utils.akka.SimpleCommandResponse
-
- All Implemented Interfaces:
org.eclipse.ditto.model.base.json.Jsonifiable<org.eclipse.ditto.json.JsonObject>
@Immutable public final class SimpleCommandResponse extends Object implements org.eclipse.ditto.model.base.json.Jsonifiable<org.eclipse.ditto.json.JsonObject>
Internal simple command response which is Jsonifiable, has an optional correlationId and optionally payload.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSimpleCommandResponse.JsonFieldsAn enumeration of the knownJsonFieldDefinitions of a SimpleCommandResponse.-
Nested classes/interfaces inherited from interface org.eclipse.ditto.model.base.json.Jsonifiable
org.eclipse.ditto.model.base.json.Jsonifiable.WithFieldSelector, org.eclipse.ditto.model.base.json.Jsonifiable.WithFieldSelectorAndPredicate<T extends Object>, org.eclipse.ditto.model.base.json.Jsonifiable.WithPointer<J extends org.eclipse.ditto.json.JsonValue>, org.eclipse.ditto.model.base.json.Jsonifiable.WithPredicate<J extends org.eclipse.ditto.json.JsonValue,T extends Object>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)static SimpleCommandResponsefromJson(String jsonString)Creates a newSimpleCommandResponsefrom a JSON string.static SimpleCommandResponsefromJson(org.eclipse.ditto.json.JsonObject jsonObject)Creates a newSimpleCommandResponsefrom a JSON object.Optional<String>getCorrelationId()Returns the optional correlationId of the SimpleCommandResponse.Optional<org.eclipse.ditto.json.JsonValue>getPayload()Returns the optional JSON payload of the SimpleCommandResponse.inthashCode()static SimpleCommandResponseof(String correlationId, org.eclipse.ditto.json.JsonValue payload)Returns a newSimpleCommandResponseinstance.org.eclipse.ditto.json.JsonObjecttoJson()StringtoString()
-
-
-
Method Detail
-
of
public static SimpleCommandResponse of(String correlationId, org.eclipse.ditto.json.JsonValue payload)
Returns a newSimpleCommandResponseinstance.- Parameters:
correlationId- an optional identifier correlating a SimpleCommand to a SimpleCommandResponse.payload- optional payload to transmit with the SimpleCommand.- Returns:
- the new SimpleCommandResponse instance.
-
fromJson
public static SimpleCommandResponse fromJson(String jsonString)
Creates a newSimpleCommandResponsefrom a JSON string.- Parameters:
jsonString- the JSON string of which a new SimpleCommandResponse is to be created.- Returns:
- the SimpleCommandResponse which was created from the given JSON string.
- 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 injsonStringwas not in the expected 'SimpleCommandResponse' format.
-
fromJson
public static SimpleCommandResponse fromJson(org.eclipse.ditto.json.JsonObject jsonObject)
Creates a newSimpleCommandResponsefrom a JSON object.- Parameters:
jsonObject- the JSON object of which a new SimpleCommandResponse is to be created.- Returns:
- the SimpleCommandResponse which was created from the given JSON object.
- Throws:
NullPointerException- ifjsonObjectisnull.IllegalArgumentException- ifjsonObjectis empty.org.eclipse.ditto.json.JsonParseException- if the passed injsonObjectis not valid JSON.org.eclipse.ditto.json.JsonMissingFieldException- if the passed injsonObjectwas not in the expected 'SimpleCommandResponse' format.
-
getCorrelationId
public Optional<String> getCorrelationId()
Returns the optional correlationId of the SimpleCommandResponse.- Returns:
- the optional correlationId of the SimpleCommandResponse.
-
getPayload
public Optional<org.eclipse.ditto.json.JsonValue> getPayload()
Returns the optional JSON payload of the SimpleCommandResponse.- Returns:
- the optional JSON payload of the SimpleCommandResponse.
-
toJson
public org.eclipse.ditto.json.JsonObject toJson()
- Specified by:
toJsonin interfaceorg.eclipse.ditto.model.base.json.Jsonifiable<org.eclipse.ditto.json.JsonObject>
-
-