/** * Creates a new {@code PolicyDeleted} from a JSON object. * * @param jsonObject the JSON object from which a new PolicyDeleted instance is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the {@code PolicyDeleted} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected * 'PolicyDeleted' format. */ public static PolicyDeleted fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<PolicyDeleted>(TYPE, jsonObject).deserialize( (revision, timestamp) -> of(jsonObject.getValueOrThrow(JsonFields.POLICY_ID), revision, timestamp, dittoHeaders)); }
/** * Creates a new {@code PolicyDeleted} from a JSON object. * * @param jsonObject the JSON object from which a new PolicyDeleted instance is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the {@code PolicyDeleted} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected * 'PolicyDeleted' format. */ public static PolicyDeleted fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<PolicyDeleted>(TYPE, jsonObject).deserialize( (revision, timestamp) -> of(jsonObject.getValueOrThrow(JsonFields.POLICY_ID), revision, timestamp, dittoHeaders)); }
/** * Creates a new {@code AttributesDeleted} from a JSON object. * * @param jsonObject the JSON object from which a new AttributesDeleted instance is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the {@code AttributesDeleted} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected * 'AttributesDeleted' format. */ public static AttributesDeleted fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<AttributesDeleted>(TYPE, jsonObject).deserialize((revision, timestamp) -> { final String extractedThingId = jsonObject.getValueOrThrow(JsonFields.THING_ID); return of(extractedThingId, revision, dittoHeaders); }); }
/** * Creates a new {@code ThingDeleted} from a JSON object. * * @param jsonObject the JSON object from which a new ThingDeleted instance is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the {@code ThingDeleted} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected * 'ThingDeleted' format. */ public static ThingDeleted fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<ThingDeleted>(TYPE, jsonObject).deserialize((revision, timestamp) -> { final String extractedThingId = jsonObject.getValueOrThrow(JsonFields.THING_ID); return of(extractedThingId, revision, timestamp, dittoHeaders); }); }
/** * Creates a {@code ConnectionDeleted} event from a JSON object. * * @param jsonObject the JSON object of which the event is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the event. * @throws NullPointerException if any argument is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected * format. */ public static ConnectionDeleted fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<ConnectionDeleted>(TYPE, jsonObject) .deserialize((revision, timestamp) -> { final String readConnectionId = jsonObject.getValueOrThrow(JsonFields.CONNECTION_ID); return of(readConnectionId, timestamp, dittoHeaders); }); }
/** * Creates a {@code ConnectionOpened} event from a JSON object. * * @param jsonObject the JSON object of which the event is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the event. * @throws NullPointerException if any argument is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected * format. */ public static ConnectionOpened fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<ConnectionOpened>(TYPE, jsonObject) .deserialize((revision, timestamp) -> { final String readConnectionId = jsonObject.getValueOrThrow(JsonFields.CONNECTION_ID); return of(readConnectionId, timestamp, dittoHeaders); }); }
/** * Creates a {@code ConnectionDeleted} event from a JSON object. * * @param jsonObject the JSON object of which the event is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the event. * @throws NullPointerException if any argument is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected * format. */ public static ConnectionDeleted fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<ConnectionDeleted>(TYPE, jsonObject) .deserialize((revision, timestamp) -> { final String readConnectionId = jsonObject.getValueOrThrow(JsonFields.CONNECTION_ID); return of(readConnectionId, timestamp, dittoHeaders); }); }
/** * Creates a new {@code FeaturesDeleted} from a JSON object. * * @param jsonObject the JSON object from which a new FeaturesDeleted instance is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the {@code FeaturesDeleted} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected * 'FeaturesDeleted' format. */ public static FeaturesDeleted fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<FeaturesDeleted>(TYPE, jsonObject).deserialize((revision, timestamp) -> { final String extractedThingId = jsonObject.getValueOrThrow(JsonFields.THING_ID); return of(extractedThingId, revision, timestamp, dittoHeaders); }); }
/** * Creates a {@code ConnectionClosed} event from a JSON object. * * @param jsonObject the JSON object of which the event is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the event. * @throws NullPointerException if any argument is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected * format. */ public static ConnectionClosed fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<ConnectionClosed>(TYPE, jsonObject) .deserialize((revision, timestamp) -> { final String readConnectionId = jsonObject.getValueOrThrow(JsonFields.CONNECTION_ID); return of(readConnectionId, timestamp, dittoHeaders); }); }
/** * Creates a new {@code PolicyModified} from a JSON object. * * @param jsonObject the JSON object from which a new PolicyModified instance is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the {@code PolicyModified} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected 'PolicyModified' format. */ public static PolicyModified fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<PolicyModified>(TYPE, jsonObject).deserialize((revision, timestamp) -> { final JsonObject policyJsonObject = jsonObject.getValueOrThrow(JSON_POLICY); final Policy extractedModifiedPolicy = PoliciesModelFactory.newPolicy(policyJsonObject); return of(extractedModifiedPolicy, revision, timestamp, dittoHeaders); }); }
/** * Creates a new {@code PolicyCreated} from a JSON object. * * @param jsonObject the JSON object from which a new PolicyCreated instance is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the {@code PolicyCreated} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonString} was not in the expected 'PolicyCreated' format. */ public static PolicyCreated fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<PolicyCreated>(TYPE, jsonObject).deserialize((revision, timestamp) -> { final JsonObject policyJsonObject = jsonObject.getValueOrThrow(JSON_POLICY); final Policy extractedModifiedPolicy = PoliciesModelFactory.newPolicy(policyJsonObject); return new PolicyCreated(extractedModifiedPolicy, revision, timestamp, dittoHeaders); }); }
/** * Creates a new {@code PolicyIdModified} from a JSON object. * * @param jsonObject the JSON object from which a new PolicyIdModified instance is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the {@code PolicyIdModified} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected * 'PolicyIdModified' format. */ public static PolicyIdModified fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<PolicyIdModified>(TYPE, jsonObject).deserialize((revision, timestamp) -> { final String extractedThingId = jsonObject.getValueOrThrow(JsonFields.THING_ID); final String extractedPolicyId = jsonObject.getValueOrThrow(JSON_POLICY_ID); return of(extractedThingId, extractedPolicyId, revision, timestamp, dittoHeaders); }); }
/** * Creates a new {@code ThingModified} from a JSON object. * * @param jsonObject the JSON object from which a new ThingModified instance is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the {@code ThingModified} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected * 'ThingModified' format. */ public static ThingModified fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<ThingModified>(TYPE, jsonObject).deserialize((revision, timestamp) -> { final JsonObject thingJsonObject = jsonObject.getValueOrThrow(JsonFields.THING); // THING was in V1 and V2 final Thing extractedModifiedThing = ThingsModelFactory.newThing(thingJsonObject); return of(extractedModifiedThing, revision, timestamp, dittoHeaders); }); }
/** * Creates a new {@code PolicyModified} from a JSON object. * * @param jsonObject the JSON object from which a new PolicyModified instance is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the {@code PolicyModified} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected 'PolicyModified' format. */ public static PolicyModified fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<PolicyModified>(TYPE, jsonObject).deserialize((revision, timestamp) -> { final JsonObject policyJsonObject = jsonObject.getValueOrThrow(JSON_POLICY); final Policy extractedModifiedPolicy = PoliciesModelFactory.newPolicy(policyJsonObject); return of(extractedModifiedPolicy, revision, timestamp, dittoHeaders); }); }
/** * Creates a new {@code PolicyCreated} from a JSON object. * * @param jsonObject the JSON object from which a new PolicyCreated instance is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the {@code PolicyCreated} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonString} was not in the expected 'PolicyCreated' format. */ public static PolicyCreated fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<PolicyCreated>(TYPE, jsonObject).deserialize((revision, timestamp) -> { final JsonObject policyJsonObject = jsonObject.getValueOrThrow(JSON_POLICY); final Policy extractedModifiedPolicy = PoliciesModelFactory.newPolicy(policyJsonObject); return new PolicyCreated(extractedModifiedPolicy, revision, timestamp, dittoHeaders); }); }
/** * Creates a new {@code FeatureFeatureDefinitionDeleted} from a JSON object. * * @param jsonObject the JSON object from which a new FeatureFeatureDefinitionDeleted instance is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the {@code FeatureFeatureDefinitionDeleted} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected * 'FeatureFeatureDefinitionDeleted' format. */ public static FeatureDefinitionDeleted fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<FeatureDefinitionDeleted>(TYPE, jsonObject) .deserialize((revision, timestamp) -> { final String extractedThingId = jsonObject.getValueOrThrow(JsonFields.THING_ID); final String extractedFeatureId = jsonObject.getValueOrThrow(JsonFields.FEATURE_ID); return of(extractedThingId, extractedFeatureId, revision, timestamp, dittoHeaders); }); }
/** * Creates a new {@code PolicyEntryDeleted} from a JSON object. * * @param jsonObject the JSON object from which a new PolicyEntryDeleted instance is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the {@code PolicyDeleted} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected 'PolicyEntryDeleted' * format. */ public static PolicyEntryDeleted fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<PolicyEntryDeleted>(TYPE, jsonObject) .deserialize((revision, timestamp) -> { final String policyId = jsonObject.getValueOrThrow(JsonFields.POLICY_ID); final Label extractedLabel = Label.of(jsonObject.getValueOrThrow(JSON_LABEL)); return of(policyId, extractedLabel, revision, timestamp, dittoHeaders); }); }
/** * Creates a new {@code ResourceDeleted} from a JSON object. * * @param jsonObject the JSON object from which a new ResourceDeleted instance is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the {@code ResourceDeleted} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected 'ResourceDeleted' format. */ public static ResourceDeleted fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<ResourceDeleted>(TYPE, jsonObject).deserialize((revision, timestamp) -> { final String policyId = jsonObject.getValueOrThrow(JsonFields.POLICY_ID); final Label label = Label.of(jsonObject.getValueOrThrow(JSON_LABEL)); final String resourceKey = jsonObject.getValueOrThrow(JSON_RESOURCE_KEY); return of(policyId, label, ResourceKey.newInstance(resourceKey), revision, timestamp, dittoHeaders); }); }
/** * Creates a new {@code SubjectDeleted} from a JSON object. * * @param jsonObject the JSON object from which a new SubjectDeleted instance is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the {@code SubjectDeleted} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected 'SubjectDeleted' format. */ public static SubjectDeleted fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<SubjectDeleted>(TYPE, jsonObject).deserialize((revision, timestamp) -> { final String policyId = jsonObject.getValueOrThrow(JsonFields.POLICY_ID); final Label label = Label.of(jsonObject.getValueOrThrow(JSON_LABEL)); final SubjectId extractedDeletedSubjectId = SubjectId.newInstance(jsonObject.getValueOrThrow(JSON_SUBJECT_ID)); return of(policyId, label, extractedDeletedSubjectId, revision, timestamp, dittoHeaders); }); }
/** * Creates a new {@code ResourceDeleted} from a JSON object. * * @param jsonObject the JSON object from which a new ResourceDeleted instance is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the {@code ResourceDeleted} which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected 'ResourceDeleted' format. */ public static ResourceDeleted fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new EventJsonDeserializer<ResourceDeleted>(TYPE, jsonObject).deserialize((revision, timestamp) -> { final String policyId = jsonObject.getValueOrThrow(JsonFields.POLICY_ID); final Label label = Label.of(jsonObject.getValueOrThrow(JSON_LABEL)); final String resourceKey = jsonObject.getValueOrThrow(JSON_RESOURCE_KEY); return of(policyId, label, ResourceKey.newInstance(resourceKey), revision, timestamp, dittoHeaders); }); }