@Immutable public final class CreateThing extends org.eclipse.ditto.signals.commands.base.AbstractCommand<CreateThing> implements ThingModifyCommand<CreateThing>
Thing including the Thing ID which should be used for
creation. If the Thing ID is already in the system, a response with a status code 409 (Conflict) will be
generated.ThingCommand.JsonFieldsorg.eclipse.ditto.model.base.json.Jsonifiable.WithFieldSelector, org.eclipse.ditto.model.base.json.Jsonifiable.WithFieldSelectorAndPredicate<T>, 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>| Modifier and Type | Field and Description |
|---|---|
static org.eclipse.ditto.json.JsonFieldDefinition<org.eclipse.ditto.json.JsonObject> |
JSON_INITIAL_POLICY
Json Field definition for the optional initial "inline" policy when creating a Thing.
|
static String |
NAME
Name of the "Create Thing" command.
|
static String |
TYPE
Type of this command.
|
RESOURCE_TYPE, TYPE_PREFIX| Modifier and Type | Method and Description |
|---|---|
protected void |
appendPayload(org.eclipse.ditto.json.JsonObjectBuilder jsonObjectBuilder,
org.eclipse.ditto.model.base.json.JsonSchemaVersion schemaVersion,
Predicate<org.eclipse.ditto.json.JsonField> thePredicate) |
protected boolean |
canEqual(Object other) |
boolean |
changesAuthorization()
Checks whether this command may change authorization of the Thing.
|
boolean |
equals(Object obj) |
static CreateThing |
fromJson(org.eclipse.ditto.json.JsonObject jsonObject,
org.eclipse.ditto.model.base.headers.DittoHeaders dittoHeaders)
Creates a new
CreateThing from a JSON object. |
static CreateThing |
fromJson(String jsonString,
org.eclipse.ditto.model.base.headers.DittoHeaders dittoHeaders)
Creates a new
CreateThing from a JSON string. |
Optional<org.eclipse.ditto.json.JsonValue> |
getEntity(org.eclipse.ditto.model.base.json.JsonSchemaVersion schemaVersion) |
Optional<org.eclipse.ditto.json.JsonObject> |
getInitialPolicy() |
org.eclipse.ditto.json.JsonPointer |
getResourcePath() |
org.eclipse.ditto.model.things.Thing |
getThing()
Returns the
Thing to create. |
String |
getThingId() |
int |
hashCode() |
static CreateThing |
of(org.eclipse.ditto.model.things.Thing newThing,
org.eclipse.ditto.json.JsonObject initialPolicy,
org.eclipse.ditto.model.base.headers.DittoHeaders dittoHeaders)
Returns a Command for creating a new Thing which is passed as argument.
|
CreateThing |
setDittoHeaders(org.eclipse.ditto.model.base.headers.DittoHeaders dittoHeaders) |
String |
toString() |
getDittoHeaders, getManifest, getType, toJsonclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetId, getResourceType, getTypePrefixgetImplementedSchemaVersion, toJson, toJsontoJson, toJsonString, toJsonStringgetLatestSchemaVersion, getSupportedSchemaVersions, implementsSchemaVersion, implementsSchemaVersion, toJsonStringpublic static final String NAME
public static final String TYPE
public static final org.eclipse.ditto.json.JsonFieldDefinition<org.eclipse.ditto.json.JsonObject> JSON_INITIAL_POLICY
public static CreateThing of(org.eclipse.ditto.model.things.Thing newThing, @Nullable org.eclipse.ditto.json.JsonObject initialPolicy, org.eclipse.ditto.model.base.headers.DittoHeaders dittoHeaders)
newThing - the new Thing to create.initialPolicy - the initial Policy to set for the Thing - may be null.dittoHeaders - the headers of the command.NullPointerException - if any argument is null.org.eclipse.ditto.model.things.ThingIdInvalidException - if the Thing's ID is not valid.org.eclipse.ditto.model.things.AclInvalidException - if the Access Control List of thing does not
contain at least one authorization subject which has the permissions Permission.READ,
Permission.WRITE and Permission.WRITE.public static CreateThing fromJson(String jsonString, org.eclipse.ditto.model.base.headers.DittoHeaders dittoHeaders)
CreateThing from a JSON string.jsonString - the JSON string of which the command is to be created.dittoHeaders - the headers of the command.NullPointerException - if jsonString is null.IllegalArgumentException - if jsonString is empty.org.eclipse.ditto.json.JsonParseException - if the passed in jsonString was not in the expected
format.public static CreateThing fromJson(org.eclipse.ditto.json.JsonObject jsonObject, org.eclipse.ditto.model.base.headers.DittoHeaders dittoHeaders)
CreateThing from a JSON object.jsonObject - the JSON object of which the command is to be created.dittoHeaders - the headers of the command.NullPointerException - if jsonObject is null.org.eclipse.ditto.json.JsonParseException - if the passed in jsonObject was not in the expected
format.public org.eclipse.ditto.model.things.Thing getThing()
Thing to create.public Optional<org.eclipse.ditto.json.JsonObject> getInitialPolicy()
Policy if there should be one applied when creating the Thing.public String getThingId()
getThingId in interface org.eclipse.ditto.signals.base.WithThingIdpublic Optional<org.eclipse.ditto.json.JsonValue> getEntity(org.eclipse.ditto.model.base.json.JsonSchemaVersion schemaVersion)
getEntity in interface org.eclipse.ditto.signals.base.WithOptionalEntitypublic org.eclipse.ditto.json.JsonPointer getResourcePath()
getResourcePath in interface org.eclipse.ditto.signals.base.WithResourceprotected void appendPayload(org.eclipse.ditto.json.JsonObjectBuilder jsonObjectBuilder,
org.eclipse.ditto.model.base.json.JsonSchemaVersion schemaVersion,
Predicate<org.eclipse.ditto.json.JsonField> thePredicate)
appendPayload in class org.eclipse.ditto.signals.commands.base.AbstractCommand<CreateThing>public CreateThing setDittoHeaders(org.eclipse.ditto.model.base.headers.DittoHeaders dittoHeaders)
setDittoHeaders in interface org.eclipse.ditto.model.base.headers.WithDittoHeaders<CreateThing>setDittoHeaders in interface org.eclipse.ditto.signals.commands.base.Command<CreateThing>setDittoHeaders in interface ThingModifyCommand<CreateThing>setDittoHeaders in interface ThingCommand<CreateThing>public boolean changesAuthorization()
ThingModifyCommandchangesAuthorization in interface ThingModifyCommand<CreateThing>true if authorization would change, false otherwise.public int hashCode()
hashCode in class org.eclipse.ditto.signals.commands.base.AbstractCommand<CreateThing>public boolean equals(@Nullable Object obj)
equals in class org.eclipse.ditto.signals.commands.base.AbstractCommand<CreateThing>protected boolean canEqual(@Nullable Object other)
canEqual in class org.eclipse.ditto.signals.commands.base.AbstractCommand<CreateThing>public String toString()
toString in class org.eclipse.ditto.signals.commands.base.AbstractCommand<CreateThing>Copyright © 2017–2018 Eclipse Foundation. All rights reserved.