Class MergeThing
- java.lang.Object
-
- org.eclipse.ditto.base.model.signals.commands.AbstractCommand<MergeThing>
-
- org.eclipse.ditto.things.model.signals.commands.modify.MergeThing
-
- All Implemented Interfaces:
org.eclipse.ditto.base.model.entity.id.WithEntityId,org.eclipse.ditto.base.model.entity.type.WithEntityType,org.eclipse.ditto.base.model.headers.DittoHeadersSettable<MergeThing>,org.eclipse.ditto.base.model.headers.WithDittoHeaders,org.eclipse.ditto.base.model.headers.WithManifest,org.eclipse.ditto.base.model.json.Jsonifiable<org.eclipse.ditto.json.JsonObject>,org.eclipse.ditto.base.model.json.Jsonifiable.WithPredicate<org.eclipse.ditto.json.JsonObject,org.eclipse.ditto.json.JsonField>,org.eclipse.ditto.base.model.signals.commands.Command<MergeThing>,org.eclipse.ditto.base.model.signals.Signal<MergeThing>,org.eclipse.ditto.base.model.signals.SignalWithEntityId<MergeThing>,org.eclipse.ditto.base.model.signals.WithName,org.eclipse.ditto.base.model.signals.WithOptionalEntity,org.eclipse.ditto.base.model.signals.WithResource,org.eclipse.ditto.base.model.signals.WithType,ThingModifyCommand<MergeThing>,ThingCommand<MergeThing>,WithThingId
@Immutable public final class MergeThing extends org.eclipse.ditto.base.model.signals.commands.AbstractCommand<MergeThing> implements ThingModifyCommand<MergeThing>
/** This command merges an existing Thing with the supplied modification. The command contains apathand avaluedescribing the change that should be applied. Thevalueat the givenpathis merged with the existing thing according to RFC7396 - JSON Merge Patch.- Since:
- 2.0.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.ditto.base.model.signals.commands.Command
org.eclipse.ditto.base.model.signals.commands.Command.Category
-
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 java.lang.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 java.lang.Object>
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNAMEName of the "Merge Thing" command.static java.lang.StringTYPEType of this command.-
Fields inherited from interface org.eclipse.ditto.base.model.signals.commands.Command
TYPE_QUALIFIER
-
Fields inherited from interface org.eclipse.ditto.things.model.signals.commands.ThingCommand
RESOURCE_TYPE, TYPE_PREFIX
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappendPayload(org.eclipse.ditto.json.JsonObjectBuilder jsonObjectBuilder, org.eclipse.ditto.base.model.json.JsonSchemaVersion schemaVersion, java.util.function.Predicate<org.eclipse.ditto.json.JsonField> predicateParameter)booleanchangesAuthorization()Checks whether this command may change authorization of the Thing.booleanequals(java.lang.Object o)static MergeThingfromJson(org.eclipse.ditto.json.JsonObject jsonObject, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)Creates a newMergeThingfrom a JSON object.org.eclipse.ditto.base.model.signals.commands.Command.CategorygetCategory()java.util.Optional<org.eclipse.ditto.json.JsonValue>getEntity()java.util.Optional<org.eclipse.ditto.json.JsonValue>getEntity(org.eclipse.ditto.base.model.json.JsonSchemaVersion schemaVersion)ThingIdgetEntityId()org.eclipse.ditto.json.JsonPointergetPath()org.eclipse.ditto.json.JsonPointergetResourcePath()org.eclipse.ditto.base.model.json.JsonSchemaVersion[]getSupportedSchemaVersions()org.eclipse.ditto.json.JsonValuegetValue()inthashCode()static MergeThingof(ThingId thingId, org.eclipse.ditto.json.JsonPointer path, org.eclipse.ditto.json.JsonValue value, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)Creates a command for merging the thing identified bythingIdwith the givenpathandvalue.MergeThingsetDittoHeaders(org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)java.lang.StringtoString()static MergeThingwithAttribute(ThingId thingId, org.eclipse.ditto.json.JsonPointer attributePath, org.eclipse.ditto.json.JsonValue attributeValue, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)Creates a command for merging the thing identified bythingIdwith the givenattributePathandattributeValue.static MergeThingwithAttributes(ThingId thingId, Attributes attributes, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)Creates a command for merging the thing identified bythingIdwith the givenattributes.static MergeThingwithFeature(ThingId thingId, Feature feature, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)Creates a command for merging the thing identified bythingIdwith the givenfeature.static MergeThingwithFeatureDefinition(ThingId thingId, java.lang.String featureId, FeatureDefinition featureDefinition, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)Creates a command for merging the feature identified bythingIdandfeatureIdwith the givenfeatureDefinition.static MergeThingwithFeatureDesiredProperties(ThingId thingId, java.lang.String featureId, FeatureProperties desiredFeatureProperties, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)Creates a command for merging the feature identified bythingIdandfeatureIdwith the givendesiredFeatureProperties.static MergeThingwithFeatureDesiredProperty(ThingId thingId, java.lang.String featureId, org.eclipse.ditto.json.JsonPointer propertyPath, org.eclipse.ditto.json.JsonValue propertyValue, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)Creates a command for merging the feature identified bythingIdandfeatureIdwith the givenpropertyPathandpropertyValue.static MergeThingwithFeatureProperties(ThingId thingId, java.lang.String featureId, FeatureProperties featureProperties, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)Creates a command for merging the feature identified bythingIdandfeatureIdwith the givenfeatureProperties.static MergeThingwithFeatureProperty(ThingId thingId, java.lang.String featureId, org.eclipse.ditto.json.JsonPointer propertyPath, org.eclipse.ditto.json.JsonValue propertyValue, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)Creates a command for merging the feature identified bythingIdandfeatureIdwith the givenpropertyPathandpropertyValue.static MergeThingwithFeatures(ThingId thingId, Features features, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)Creates a command for merging the thing identified bythingIdwith the givenfeatures.static MergeThingwithPolicyId(ThingId thingId, org.eclipse.ditto.policies.model.PolicyId policyId, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)Creates a command for merging the thing identified bythingIdwith the givenpolicyId.static MergeThingwithThing(ThingId thingId, Thing thing, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)Creates a command for merging the thing identified bythingIdwith the giventhing.static MergeThingwithThingDefinition(ThingId thingId, ThingDefinition thingDefinition, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)Creates a command for merging the thing identified bythingIdwith the giventhingDefinition.-
Methods inherited from class org.eclipse.ditto.base.model.signals.commands.AbstractCommand
canEqual, getDittoHeaders, getManifest, getType, toJson
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.ditto.base.model.signals.commands.Command
getImplementedSchemaVersion, toJson, toJson
-
Methods inherited from interface org.eclipse.ditto.base.model.json.Jsonifiable
getLatestSchemaVersion, implementsSchemaVersion, implementsSchemaVersion, toJsonString
-
Methods inherited from interface org.eclipse.ditto.base.model.json.Jsonifiable.WithPredicate
toJson, toJsonString, toJsonString
-
Methods inherited from interface org.eclipse.ditto.things.model.signals.commands.ThingCommand
getEntityType, getResourceType, getTypePrefix
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
Name of the "Merge Thing" command.- See Also:
- Constant Field Values
-
TYPE
public static final java.lang.String TYPE
Type of this command.- See Also:
- Constant Field Values
-
-
Method Detail
-
of
public static MergeThing of(ThingId thingId, org.eclipse.ditto.json.JsonPointer path, org.eclipse.ditto.json.JsonValue value, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)
Creates a command for merging the thing identified bythingIdwith the givenpathandvalue.- Parameters:
thingId- the thing id.path- the path that is merged with the existing thing.value- the value describing the changes that are merged with the existing thing.dittoHeaders- the ditto headers.- Returns:
- the created
MergeThingcommand.
-
withThing
public static MergeThing withThing(ThingId thingId, Thing thing, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)
Creates a command for merging the thing identified bythingIdwith the giventhing.- Parameters:
thingId- the thing id.thing- the thing that is merged with the existing thing.dittoHeaders- the ditto headers.- Returns:
- the created
MergeThingcommand.
-
withPolicyId
public static MergeThing withPolicyId(ThingId thingId, org.eclipse.ditto.policies.model.PolicyId policyId, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)
Creates a command for merging the thing identified bythingIdwith the givenpolicyId.- Parameters:
thingId- the thing id.policyId- the policyId that is merged with the existing thing.dittoHeaders- the ditto headers.- Returns:
- the created
MergeThingcommand.
-
withThingDefinition
public static MergeThing withThingDefinition(ThingId thingId, ThingDefinition thingDefinition, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)
Creates a command for merging the thing identified bythingIdwith the giventhingDefinition.- Parameters:
thingId- the thing id.thingDefinition- the thing definition that is merged with the existing thing.dittoHeaders- the ditto headers.- Returns:
- the created
MergeThingcommand.
-
withAttributes
public static MergeThing withAttributes(ThingId thingId, Attributes attributes, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)
Creates a command for merging the thing identified bythingIdwith the givenattributes.- Parameters:
thingId- the thing id.attributes- the attributes that are merged with the existing thing.dittoHeaders- the ditto headers.- Returns:
- the created
MergeThingcommand.
-
withAttribute
public static MergeThing withAttribute(ThingId thingId, org.eclipse.ditto.json.JsonPointer attributePath, org.eclipse.ditto.json.JsonValue attributeValue, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)
Creates a command for merging the thing identified bythingIdwith the givenattributePathandattributeValue.- Parameters:
thingId- the thing id.attributePath- the path where the attribute value is merged with the existing thing.attributeValue- the attribute value that is merged with the existing thing.dittoHeaders- the ditto headers.- Returns:
- the created
MergeThingcommand.
-
withFeatures
public static MergeThing withFeatures(ThingId thingId, Features features, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)
Creates a command for merging the thing identified bythingIdwith the givenfeatures.- Parameters:
thingId- the thing id.features- the features that are merged with the existing thing.dittoHeaders- the ditto headers.- Returns:
- the created
MergeThingcommand.
-
withFeature
public static MergeThing withFeature(ThingId thingId, Feature feature, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)
Creates a command for merging the thing identified bythingIdwith the givenfeature.- Parameters:
thingId- the thing id.feature- the feature that is merged with the existing thing.dittoHeaders- the ditto headers.- Returns:
- the created
MergeThingcommand.
-
withFeatureDefinition
public static MergeThing withFeatureDefinition(ThingId thingId, java.lang.String featureId, FeatureDefinition featureDefinition, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)
Creates a command for merging the feature identified bythingIdandfeatureIdwith the givenfeatureDefinition.- Parameters:
thingId- the thing id.featureId- the feature id identifying the feature.featureDefinition- the feature definition that is merged with the existing feature.dittoHeaders- the ditto headers.- Returns:
- the created
MergeThingcommand.
-
withFeatureProperties
public static MergeThing withFeatureProperties(ThingId thingId, java.lang.String featureId, FeatureProperties featureProperties, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)
Creates a command for merging the feature identified bythingIdandfeatureIdwith the givenfeatureProperties.- Parameters:
thingId- the thing id.featureId- the feature id identifying the feature.featureProperties- the featureProperties that are merged with the existing feature.dittoHeaders- the ditto headers.- Returns:
- the created
MergeThingcommand.
-
withFeatureProperty
public static MergeThing withFeatureProperty(ThingId thingId, java.lang.String featureId, org.eclipse.ditto.json.JsonPointer propertyPath, org.eclipse.ditto.json.JsonValue propertyValue, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)
Creates a command for merging the feature identified bythingIdandfeatureIdwith the givenpropertyPathandpropertyValue.- Parameters:
thingId- the thing id.featureId- the feature id identifying the feature.propertyPath- the path where the property value is merged with the existing feature properties.propertyValue- the property value that is merged with the existing feature properties.dittoHeaders- the ditto headers.- Returns:
- the created
MergeThingcommand.
-
withFeatureDesiredProperties
public static MergeThing withFeatureDesiredProperties(ThingId thingId, java.lang.String featureId, FeatureProperties desiredFeatureProperties, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)
Creates a command for merging the feature identified bythingIdandfeatureIdwith the givendesiredFeatureProperties.- Parameters:
thingId- the thing id.featureId- the feature id identifying the feature.desiredFeatureProperties- the desired feature properties that are merged with the existing feature.dittoHeaders- the ditto headers.- Returns:
- the created
MergeThingcommand.
-
withFeatureDesiredProperty
public static MergeThing withFeatureDesiredProperty(ThingId thingId, java.lang.String featureId, org.eclipse.ditto.json.JsonPointer propertyPath, org.eclipse.ditto.json.JsonValue propertyValue, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)
Creates a command for merging the feature identified bythingIdandfeatureIdwith the givenpropertyPathandpropertyValue.- Parameters:
thingId- the thing id.featureId- the feature id identifying the feature.propertyPath- the path where the property value is merged with the existing desired feature properties.propertyValue- the property value that is merged with the existing desired feature properties.dittoHeaders- the ditto headers.- Returns:
- the created
MergeThingcommand.
-
fromJson
public static MergeThing fromJson(org.eclipse.ditto.json.JsonObject jsonObject, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)
Creates a newMergeThingfrom a JSON object.- Parameters:
jsonObject- the JSON object of which the command is to be created.dittoHeaders- the headers of the command.- Returns:
- the
MergeThingcommand created from JSON. - Throws:
java.lang.NullPointerException- ifjsonObjectisnull.org.eclipse.ditto.json.JsonParseException- if the passed injsonObjectwas not in the expected format.org.eclipse.ditto.json.JsonMissingFieldException- ifjsonObjectdid not contain a field forThingCommand.JsonFields.JSON_THING_ID,MergeThing.JsonFields.JSON_PATHorMergeThing.JsonFields.JSON_VALUE.
-
getPath
public org.eclipse.ditto.json.JsonPointer getPath()
- Returns:
- the path where the changes are applied.
-
getEntityId
public ThingId getEntityId()
- Specified by:
getEntityIdin interfaceorg.eclipse.ditto.base.model.entity.id.WithEntityId- Specified by:
getEntityIdin interfaceWithThingId
-
getEntity
public java.util.Optional<org.eclipse.ditto.json.JsonValue> getEntity()
- Specified by:
getEntityin interfaceorg.eclipse.ditto.base.model.signals.WithOptionalEntity
-
getEntity
public java.util.Optional<org.eclipse.ditto.json.JsonValue> getEntity(org.eclipse.ditto.base.model.json.JsonSchemaVersion schemaVersion)
- Specified by:
getEntityin interfaceorg.eclipse.ditto.base.model.signals.WithOptionalEntity
-
getResourcePath
public org.eclipse.ditto.json.JsonPointer getResourcePath()
- Specified by:
getResourcePathin interfaceorg.eclipse.ditto.base.model.signals.WithResource
-
changesAuthorization
public boolean changesAuthorization()
Description copied from interface:ThingModifyCommandChecks whether this command may change authorization of the Thing.- Specified by:
changesAuthorizationin interfaceThingModifyCommand<MergeThing>- Returns:
trueif authorization would change,falseotherwise.
-
getCategory
public org.eclipse.ditto.base.model.signals.commands.Command.Category getCategory()
- Specified by:
getCategoryin interfaceorg.eclipse.ditto.base.model.signals.commands.Command<MergeThing>
-
setDittoHeaders
public MergeThing setDittoHeaders(org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders)
- Specified by:
setDittoHeadersin interfaceorg.eclipse.ditto.base.model.signals.commands.Command<MergeThing>- Specified by:
setDittoHeadersin interfaceorg.eclipse.ditto.base.model.headers.DittoHeadersSettable<MergeThing>- Specified by:
setDittoHeadersin interfaceThingCommand<MergeThing>- Specified by:
setDittoHeadersin interfaceThingModifyCommand<MergeThing>
-
appendPayload
protected void appendPayload(org.eclipse.ditto.json.JsonObjectBuilder jsonObjectBuilder, org.eclipse.ditto.base.model.json.JsonSchemaVersion schemaVersion, java.util.function.Predicate<org.eclipse.ditto.json.JsonField> predicateParameter)- Specified by:
appendPayloadin classorg.eclipse.ditto.base.model.signals.commands.AbstractCommand<MergeThing>
-
getSupportedSchemaVersions
public org.eclipse.ditto.base.model.json.JsonSchemaVersion[] getSupportedSchemaVersions()
- Specified by:
getSupportedSchemaVersionsin interfaceorg.eclipse.ditto.base.model.json.Jsonifiable<org.eclipse.ditto.json.JsonObject>
-
getValue
public org.eclipse.ditto.json.JsonValue getValue()
- Returns:
- the value describing the changes that are applied to the existing thing.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classorg.eclipse.ditto.base.model.signals.commands.AbstractCommand<MergeThing>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classorg.eclipse.ditto.base.model.signals.commands.AbstractCommand<MergeThing>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classorg.eclipse.ditto.base.model.signals.commands.AbstractCommand<MergeThing>
-
-