/** * Constructs a new {@code CommandResponseJsonDeserializer} object. * * @param type the type of the target command response of deserialization. * @param jsonString the JSON string to be deserialized. * @throws NullPointerException if any argument is {@code null}. * @throws IllegalArgumentException if {@code jsonString} is empty. * @throws org.eclipse.ditto.json.JsonParseException if {@code jsonString} does not contain a valid JSON object. */ public CommandResponseJsonDeserializer(final String type, final String jsonString) { this(type, JsonFactory.newObject(jsonString)); }
/** * Constructs a new {@code CommandResponseJsonDeserializer} object. * * @param type the type of the target command response of deserialization. * @param jsonString the JSON string to be deserialized. * @throws NullPointerException if any argument is {@code null}. * @throws IllegalArgumentException if {@code jsonString} is empty. * @throws org.eclipse.ditto.json.JsonParseException if {@code jsonString} does not contain a valid JSON object. */ public CommandResponseJsonDeserializer(final String type, final String jsonString) { this(type, JsonFactory.newObject(jsonString)); }
/** * Constructs a new {@code CommandJsonDeserializer} object. * * @param type the type of the target command of deserialization. * @param jsonString the JSON string to be deserialized. * @throws NullPointerException if any argument is {@code null}. * @throws IllegalArgumentException if {@code jsonString} is empty. * @throws org.eclipse.ditto.json.JsonParseException if {@code jsonString} does not contain a valid JSON object. */ public CommandJsonDeserializer(final String type, final String jsonString) { this(type, JsonFactory.newObject(jsonString)); }
/** * Constructs a new {@code EventJsonDeserializer} object. * * @param type the type of the event to deserialize to. * @param jsonString the JSON string to be deserialized. * @throws NullPointerException if any argument is {@code null}. * @throws IllegalArgumentException if {@code jsonString} is empty. * @throws org.eclipse.ditto.json.JsonParseException if {@code jsonString} does not contain a valid JSON object. */ public EventJsonDeserializer(final String type, final String jsonString) { this(type, JsonFactory.newObject(jsonString)); }
/** * Creates a {@code JsonObject} from the given string. * * @param jsonObjectString the string that represents the JSON object. * @return the JSON object that has been created from the string. * @throws NullPointerException if {@code jsonObjectString} is {@code null}. * @throws IllegalArgumentException if {@code jsonObjectString} is empty. * @throws JsonParseException if {@code jsonObjectString} does not represent a valid JSON object. */ static JsonObject of(final String jsonObjectString) { return JsonFactory.newObject(jsonObjectString); }
/** * Returns an new empty instance of {@code ImmutableFeatureProperties}. * * @return the new empty properties. */ public static FeatureProperties empty() { return new ImmutableFeatureProperties(JsonFactory.newObject()); }
/** * Creates a new {@code SubjectCreated} from a JSON string. * * @param jsonString the JSON string from which a new SubjectCreated instance is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the {@code SubjectCreated} which was created from the given JSON string. * @throws NullPointerException if {@code jsonString} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonString} was not in the expected 'SubjectCreated' format. */ public static SubjectCreated fromJson(final String jsonString, final DittoHeaders dittoHeaders) { return fromJson(JsonFactory.newObject(jsonString), dittoHeaders); }
/** * Creates a new {@code SubjectDeleted} from a JSON string. * * @param jsonString the JSON string 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 string. * @throws NullPointerException if {@code jsonString} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonString} was not in the expected 'SubjectDeleted' format. */ public static SubjectDeleted fromJson(final String jsonString, final DittoHeaders dittoHeaders) { return fromJson(JsonFactory.newObject(jsonString), dittoHeaders); }
/** * Creates a new {@code LoggerConfig} object from the specified JSON string. * * @param jsonString a JSON string which provides the data for the LoggerConfig to be created. * @return a new LoggerConfig which is initialised with the extracted data from {@code jsonString}. * @throws NullPointerException if {@code jsonString} is {@code null}. * @throws JsonMissingFieldException if {@code jsonString} does not contain all required fields. * @throws JsonParseException if {@code jsonString} contains invalid JSON. */ public static LoggerConfig fromJson(final String jsonString) { return fromJson(JsonFactory.newObject(jsonString)); }
/** * Creates a new {@code PolicyCreated} from a JSON string. * * @param jsonString the JSON string 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 string. * @throws NullPointerException if {@code jsonString} 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 String jsonString, final DittoHeaders dittoHeaders) { return fromJson(JsonFactory.newObject(jsonString), dittoHeaders); }
/** * Creates a new {@code ResourceCreated} from a JSON string. * * @param jsonString the JSON string from which a new ResourceCreated instance is to be created. * @param dittoHeaders the headers of the command which was the cause of this event. * @return the {@code ResourceCreated} which was created from the given JSON string. * @throws NullPointerException if {@code jsonString} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonString} was not in the expected 'ResourceCreated' format. */ public static ResourceCreated fromJson(final String jsonString, final DittoHeaders dittoHeaders) { return fromJson(JsonFactory.newObject(jsonString), dittoHeaders); }
/** * Returns a new {@code Payload} from the specified {@code jsonString}. * * @param jsonString the JSON string. * @return the payload. * @throws NullPointerException if {@code jsonString} is {@code null}. * @throws IllegalArgumentException if {@code jsonString} is empty. * @throws org.eclipse.ditto.json.JsonParseException if {@code jsonString} does not contain a JSON object. */ public static Payload newPayload(final String jsonString) { return newPayload(JsonFactory.newObject(jsonString)); }
/** * Creates a new {@code SubjectDeleted} from a JSON string. * * @param jsonString the JSON string 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 string. * @throws NullPointerException if {@code jsonString} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonString} was not in the expected 'SubjectDeleted' format. */ public static SubjectDeleted fromJson(final String jsonString, final DittoHeaders dittoHeaders) { return fromJson(JsonFactory.newObject(jsonString), dittoHeaders); }
/** * Creates a new {@code PolicyModified} from a JSON string. * * @param jsonString the JSON string 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 string. * @throws NullPointerException if {@code jsonString} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonString} was not in the expected 'PolicyModified' format. */ public static PolicyModified fromJson(final String jsonString, final DittoHeaders dittoHeaders) { return fromJson(JsonFactory.newObject(jsonString), dittoHeaders); }
private static String getCopyPolicyFrom(final String jsonString) { final JsonObject inputJson = wrapJsonRuntimeException(() -> JsonFactory.newObject(jsonString)); return inputJson.getValue(ModifyThing.JSON_COPY_POLICY_FROM) .orElse(null); }
/** * Returns a new immutable Iterable of Policy entries based on the given JSON string. * * @param jsonString the JSON object representation as String of Policy entries. * @return the new initialised {@code Policy}. * @throws org.eclipse.ditto.model.base.exceptions.DittoJsonException if {@code jsonObject} cannot be parsed to * {@link Iterable} of {@link PolicyEntry}s. */ public static Iterable<PolicyEntry> newPolicyEntries(final String jsonString) { final JsonObject jsonObject = wrapJsonRuntimeException(() -> JsonFactory.newObject(jsonString)); return newPolicyEntries(jsonObject); }
/** * Returns a new immutable {@link Features} based on the given JSON string. * * @param jsonString provides the initial values of the result. * @return the new immutable initialised {@code Features}. * @throws DittoJsonException if {@code jsonString} cannot be parsed to {@code Features}. */ public static Features newFeatures(final String jsonString) { final JsonObject featuresJsonObject = DittoJsonException.wrapJsonRuntimeException(() -> JsonFactory.newObject(jsonString)); return newFeatures(featuresJsonObject); }
public static PolicyErrorResponse fromJson(final String jsonString, final DittoHeaders dittoHeaders) { final JsonObject jsonObject = DittoJsonException.wrapJsonRuntimeException(() -> JsonFactory.newObject(jsonString)); return fromJson(jsonObject, dittoHeaders); }
/** * Returns a new immutable {@link Features} based on the given JSON string. * * @param jsonString provides the initial values of the result. * @return the new immutable initialised {@code Features}. * @throws DittoJsonException if {@code jsonString} cannot be parsed to {@code Features}. */ public static Features newFeatures(final String jsonString) { final JsonObject featuresJsonObject = DittoJsonException.wrapJsonRuntimeException(() -> JsonFactory.newObject(jsonString)); return newFeatures(featuresJsonObject); }
private static Subject createSubjectForPut(final String jsonString, final CharSequence subjectId) { final JsonObject jsonObject = wrapJsonRuntimeException(() -> JsonFactory.newObject(jsonString)); final String subjectTypeString = jsonObject.getValueOrThrow(Subject.JsonFields.TYPE); final SubjectType subjectType = PoliciesModelFactory.newSubjectType(subjectTypeString); return PoliciesModelFactory.newSubject(SubjectId.newInstance(subjectId), subjectType); }