Class 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.
    • Method Detail

      • of

        public static SimpleCommandResponse of​(String correlationId,
                                               org.eclipse.ditto.json.JsonValue payload)
        Returns a new SimpleCommandResponse instance.
        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 new SimpleCommandResponse from 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 - if jsonString is null.
        IllegalArgumentException - if jsonString is empty.
        org.eclipse.ditto.json.JsonParseException - if the passed in jsonString does not contain a JSON object or if it is not valid JSON.
        org.eclipse.ditto.json.JsonMissingFieldException - if the passed in jsonString was not in the expected 'SimpleCommandResponse' format.
      • fromJson

        public static SimpleCommandResponse fromJson​(org.eclipse.ditto.json.JsonObject jsonObject)
        Creates a new SimpleCommandResponse from 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 - if jsonObject is null.
        IllegalArgumentException - if jsonObject is empty.
        org.eclipse.ditto.json.JsonParseException - if the passed in jsonObject is not valid JSON.
        org.eclipse.ditto.json.JsonMissingFieldException - if the passed in jsonObject was 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:
        toJson in interface org.eclipse.ditto.model.base.json.Jsonifiable<org.eclipse.ditto.json.JsonObject>
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object