Class ThingNotCreatableException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.eclipse.ditto.base.model.exceptions.DittoRuntimeException
org.eclipse.ditto.things.model.signals.commands.exceptions.ThingNotCreatableException
- All Implemented Interfaces:
Serializable,org.eclipse.ditto.base.model.headers.DittoHeadersSettable<org.eclipse.ditto.base.model.exceptions.DittoRuntimeException>,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> ThingException
@Immutable
public final class ThingNotCreatableException
extends org.eclipse.ditto.base.model.exceptions.DittoRuntimeException
implements ThingException
Thrown if a Thing could not be created because a linked Policy ID was not existing for example.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA mutable builder with a fluent API for aThingNotCreatableException.Nested classes/interfaces inherited from class org.eclipse.ditto.base.model.exceptions.DittoRuntimeException
org.eclipse.ditto.base.model.exceptions.DittoRuntimeException.JsonFieldsNested 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
FieldsFields inherited from interface org.eclipse.ditto.things.model.ThingException
ERROR_CODE_PREFIX -
Method Summary
Modifier and TypeMethodDescriptionstatic ThingNotCreatableExceptionforLiveChannel(org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders) Returns a new instance ofThingNotCreatableExceptionthat is caused by using the unsupported "live" channel for sending aCreateThingcommand.static ThingNotCreatableExceptionfromJson(org.eclipse.ditto.json.JsonObject jsonObject, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders) Constructs a newThingNotCreatableExceptionobject with the exception message extracted from the given JSON object.static ThingNotCreatableExceptionfromMessage(String message, String description, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders) Constructs a newThingNotCreatableExceptionobject with the given exception message.newBuilderForOtherReason(org.eclipse.ditto.base.model.common.HttpStatus httpStatus, ThingId thingId, org.eclipse.ditto.policies.model.PolicyId policyId, String reason) A mutable builder for aThingNotCreatableExceptionthrown if a Thing could not be created because the creation of its implicit Policy failed due to a reason passed asreason.newBuilderForPolicyExisting(ThingId thingId, org.eclipse.ditto.policies.model.PolicyId policyId) A mutable builder for aThingNotCreatableExceptionthrown if a Thing could not be created because the creation of its implicit Policy failed.newBuilderForPolicyMissing(ThingId thingId, org.eclipse.ditto.policies.model.PolicyId policyId) A mutable builder for aThingNotCreatableExceptionthrown if a Thing could not be created because a referenced Policy in the Thing to be created is missing.org.eclipse.ditto.base.model.exceptions.DittoRuntimeExceptionsetDittoHeaders(org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders) Methods inherited from class org.eclipse.ditto.base.model.exceptions.DittoRuntimeException
appendToJson, asDittoRuntimeException, equals, fromJson, fromMessage, getDescription, getDittoHeaders, getErrorCode, getHref, getHref, getHttpStatus, getHttpStatus, getImplementedSchemaVersion, getManifest, hashCode, toBuilder, toJson, toJson, toStringMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTraceMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.ditto.base.model.json.Jsonifiable
getLatestSchemaVersion, getSupportedSchemaVersions, implementsSchemaVersion, implementsSchemaVersion, toJsonStringMethods inherited from interface org.eclipse.ditto.base.model.json.Jsonifiable.WithPredicate
toJson, toJsonString, toJsonString
-
Field Details
-
ERROR_CODE
Error code of this exception.- See Also:
-
-
Method Details
-
newBuilderForPolicyMissing
public static ThingNotCreatableException.Builder newBuilderForPolicyMissing(ThingId thingId, org.eclipse.ditto.policies.model.PolicyId policyId) A mutable builder for aThingNotCreatableExceptionthrown if a Thing could not be created because a referenced Policy in the Thing to be created is missing.- Parameters:
thingId- the ID of the Thing.policyId- the ID of the Policy which was used when creating the Thing.- Returns:
- the builder.
-
newBuilderForPolicyExisting
public static ThingNotCreatableException.Builder newBuilderForPolicyExisting(ThingId thingId, org.eclipse.ditto.policies.model.PolicyId policyId) A mutable builder for aThingNotCreatableExceptionthrown if a Thing could not be created because the creation of its implicit Policy failed.- Parameters:
thingId- the ID of the Thing.policyId- the ID of the Policy which was used when creating the Thing.- Returns:
- the builder.
-
newBuilderForOtherReason
public static ThingNotCreatableException.Builder newBuilderForOtherReason(org.eclipse.ditto.base.model.common.HttpStatus httpStatus, ThingId thingId, org.eclipse.ditto.policies.model.PolicyId policyId, String reason) A mutable builder for aThingNotCreatableExceptionthrown if a Thing could not be created because the creation of its implicit Policy failed due to a reason passed asreason.- Parameters:
thingId- the ID of the Thing.policyId- the ID of the Policy which was used when creating the Thing.reason- the reason why the implicit policy creation failed.- Returns:
- the builder.
-
forLiveChannel
public static ThingNotCreatableException forLiveChannel(org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders) Returns a new instance ofThingNotCreatableExceptionthat is caused by using the unsupported "live" channel for sending aCreateThingcommand.- Parameters:
dittoHeaders- the headers of the command which resulted in the returned exception.- Throws:
NullPointerException- ifdittoHeadersisnull.- Since:
- 2.3.0
-
fromMessage
public static ThingNotCreatableException fromMessage(@Nullable String message, @Nullable String description, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders) Constructs a newThingNotCreatableExceptionobject with the given exception message.- Parameters:
message- detail message. This message can be later retrieved by theThrowable.getMessage()method.description- the description which may benull.dittoHeaders- the headers of the command which resulted in this exception.- Returns:
- the new ThingNotCreatableException.
- Throws:
NullPointerException- ifdittoHeadersisnull.
-
fromJson
public static ThingNotCreatableException fromJson(org.eclipse.ditto.json.JsonObject jsonObject, org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders) Constructs a newThingNotCreatableExceptionobject with the exception message extracted from the given JSON object.- Parameters:
jsonObject- the JSON to read theDittoRuntimeException.JsonFields.MESSAGEfield from.dittoHeaders- the headers of the command which resulted in this exception.- Returns:
- the new ThingNotCreatableException.
- Throws:
NullPointerException- if any argument isnull.org.eclipse.ditto.json.JsonMissingFieldException- if this JsonObject did not contain an error message.org.eclipse.ditto.json.JsonParseException- if the passed injsonObjectwas not in the expected format.
-
setDittoHeaders
public org.eclipse.ditto.base.model.exceptions.DittoRuntimeException setDittoHeaders(org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders) - Specified by:
setDittoHeadersin interfaceorg.eclipse.ditto.base.model.headers.DittoHeadersSettable<org.eclipse.ditto.base.model.exceptions.DittoRuntimeException>
-