@Override public JsonFieldSelectorBuilder addFieldSelectorString(@Nullable final String fieldSelectorString) { final JsonParseOptions options = JsonFactory.newParseOptionsBuilder().withoutUrlDecoding().build(); return addFieldSelectorString(fieldSelectorString, options); }
.map(fields -> JsonFactory.newFieldSelector(fields, JsonFactory.newParseOptionsBuilder().build())) .orElse(null);
.map(fields -> JsonFactory.newFieldSelector(fields, JsonFactory.newParseOptionsBuilder().build())) .orElse(null);
@Override public JsonFieldSelectorBuilder addFieldSelectorString(@Nullable final String fieldSelectorString) { final JsonParseOptions options = JsonFactory.newParseOptionsBuilder().withoutUrlDecoding().build(); return addFieldSelectorString(fieldSelectorString, options); }
/** * Creates a new {@code SudoRetrieveThings} from a JSON object. * * @param jsonObject the JSON string of which a new SudoRetrieveThings is to be created. * @param dittoHeaders the optional command headers of the request. * @return the SudoRetrieveThings which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonMissingFieldException if the passed in {@code jsonObject} was not in the * expected format. */ public static SudoRetrieveThings fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { final List<String> extractedThingIds = jsonObject.getValueOrThrow(JSON_THING_IDS) .stream() .filter(JsonValue::isString) .map(JsonValue::asString) .collect(Collectors.toList()); final JsonFieldSelector extractedFieldSelector = jsonObject.getValue(SudoCommand.JsonFields.SELECTED_FIELDS) .map(str -> JsonFactory.newFieldSelector(str, JsonFactory.newParseOptionsBuilder() .withoutUrlDecoding() .build())) .orElse(null); return SudoRetrieveThings.of(extractedThingIds, extractedFieldSelector, dittoHeaders); }
/** * Creates a new {@code SudoRetrieveThings} from a JSON object. * * @param jsonObject the JSON string of which a new SudoRetrieveThings is to be created. * @param dittoHeaders the optional command headers of the request. * @return the SudoRetrieveThings which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonMissingFieldException if the passed in {@code jsonObject} was not in the * expected format. */ public static SudoRetrieveThings fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { final List<String> extractedThingIds = jsonObject.getValueOrThrow(JSON_THING_IDS) .stream() .filter(JsonValue::isString) .map(JsonValue::asString) .collect(Collectors.toList()); final JsonFieldSelector extractedFieldSelector = jsonObject.getValue(SudoCommand.JsonFields.SELECTED_FIELDS) .map(str -> JsonFactory.newFieldSelector(str, JsonFactory.newParseOptionsBuilder() .withoutUrlDecoding() .build())) .orElse(null); return SudoRetrieveThings.of(extractedThingIds, extractedFieldSelector, dittoHeaders); }
/** * Creates a new {@code SudoRetrieveThing} from a JSON object. * * @param jsonObject the JSON string of which a new SudoRetrieveThing is to be created. * @param dittoHeaders the optional command headers of the request. * @return the SudoRetrieveThing which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonMissingFieldException if the passed in {@code jsonObject} was not in the * expected format. */ public static SudoRetrieveThing fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { final String readThingId = jsonObject.getValueOrThrow(SudoCommand.JsonFields.JSON_THING_ID); final JsonFieldSelector readFieldSelector = jsonObject.getValue(SudoCommand.JsonFields.SELECTED_FIELDS) .map(str -> JsonFactory.newFieldSelector(str, JsonFactory.newParseOptionsBuilder() .withoutUrlDecoding() .build()) ) .orElse(null); final boolean isUseOriginalSchemaVersion = jsonObject.getValue(JSON_USE_ORIGINAL_SCHEMA_VERSION).orElse(false); return new SudoRetrieveThing(readThingId, readFieldSelector, dittoHeaders, isUseOriginalSchemaVersion); }
/** * Creates a new {@code RetrieveThings} from a JSON object. * * @param jsonObject the JSON object of which the command is to be created. * @param dittoHeaders the headers of the command. * @return the command. * @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 * format. */ public static RetrieveThings fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { final String namespace = jsonObject.getValue(JSON_NAMESPACE).orElse(null); final List<String> extractedThingIds = jsonObject.getValueOrThrow(JSON_THING_IDS) .stream() .filter(JsonValue::isString) .map(JsonValue::asString) .collect(Collectors.toList()); final JsonFieldSelector extractedFieldSelector = jsonObject.getValue(JSON_SELECTED_FIELDS) .map(str -> JsonFactory.newFieldSelector(str, JsonFactory.newParseOptionsBuilder() .withoutUrlDecoding() .build())) .orElse(null); return new RetrieveThings(extractedThingIds, extractedFieldSelector, namespace, dittoHeaders); }
/** * Creates a new {@code RetrieveThings} from a JSON object. * * @param jsonObject the JSON object of which the command is to be created. * @param dittoHeaders the headers of the command. * @return the command. * @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 * format. */ public static RetrieveThings fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { final String namespace = jsonObject.getValue(JSON_NAMESPACE).orElse(null); final List<String> extractedThingIds = jsonObject.getValueOrThrow(JSON_THING_IDS) .stream() .filter(JsonValue::isString) .map(JsonValue::asString) .collect(Collectors.toList()); final JsonFieldSelector extractedFieldSelector = jsonObject.getValue(JSON_SELECTED_FIELDS) .map(str -> JsonFactory.newFieldSelector(str, JsonFactory.newParseOptionsBuilder() .withoutUrlDecoding() .build())) .orElse(null); return new RetrieveThings(extractedThingIds, extractedFieldSelector, namespace, dittoHeaders); }
/** * Creates a new {@code SudoRetrieveThing} from a JSON object. * * @param jsonObject the JSON string of which a new SudoRetrieveThing is to be created. * @param dittoHeaders the optional command headers of the request. * @return the SudoRetrieveThing which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonMissingFieldException if the passed in {@code jsonObject} was not in the * expected format. */ public static SudoRetrieveThing fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { final String readThingId = jsonObject.getValueOrThrow(SudoCommand.JsonFields.JSON_THING_ID); final JsonFieldSelector readFieldSelector = jsonObject.getValue(SudoCommand.JsonFields.SELECTED_FIELDS) .map(str -> JsonFactory.newFieldSelector(str, JsonFactory.newParseOptionsBuilder() .withoutUrlDecoding() .build()) ) .orElse(null); final boolean isUseOriginalSchemaVersion = jsonObject.getValue(JSON_USE_ORIGINAL_SCHEMA_VERSION).orElse(false); return new SudoRetrieveThing(readThingId, readFieldSelector, dittoHeaders, isUseOriginalSchemaVersion); }
/** * Creates a new {@code RetrieveAttributes} from a JSON object. * * @param jsonObject the JSON object of which the command is to be created. * @param dittoHeaders the headers of the command. * @return the command. * @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. * @throws org.eclipse.ditto.model.things.ThingIdInvalidException if the parsed thing ID did not comply to {@link * org.eclipse.ditto.model.things.Thing#ID_REGEX}. */ public static RetrieveAttributes fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new CommandJsonDeserializer<RetrieveAttributes>(TYPE, jsonObject).deserialize(() -> { final String thingId = jsonObject.getValueOrThrow(ThingQueryCommand.JsonFields.JSON_THING_ID); final JsonFieldSelector extractedFieldSelector = jsonObject.getValue(JSON_SELECTED_FIELDS) .map(str -> JsonFactory.newFieldSelector(str, JsonFactory.newParseOptionsBuilder() .withoutUrlDecoding() .build())) .orElse(null); return of(thingId, extractedFieldSelector, dittoHeaders); }); }
/** * Creates a new {@code RetrieveFeatures} from a JSON object. * * @param jsonObject the JSON object of which the command is to be created. * @param dittoHeaders the headers of the command. * @return the command. * @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. * @throws org.eclipse.ditto.model.things.ThingIdInvalidException if the parsed thing ID did not comply to {@link * org.eclipse.ditto.model.things.Thing#ID_REGEX}. */ public static RetrieveFeatures fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new CommandJsonDeserializer<RetrieveFeatures>(TYPE, jsonObject).deserialize(() -> { final String thingId = jsonObject.getValueOrThrow(ThingQueryCommand.JsonFields.JSON_THING_ID); final JsonFieldSelector extractedFieldSelector = jsonObject.getValue(JSON_SELECTED_FIELDS) .map(str -> JsonFactory.newFieldSelector(str, JsonFactory.newParseOptionsBuilder() .withoutUrlDecoding() .build())) .orElse(null); return of(thingId, extractedFieldSelector, dittoHeaders); }); }
/** * Creates a new {@code RetrieveAttributes} from a JSON object. * * @param jsonObject the JSON object of which the command is to be created. * @param dittoHeaders the headers of the command. * @return the command. * @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. * @throws org.eclipse.ditto.model.things.ThingIdInvalidException if the parsed thing ID did not comply to {@link * org.eclipse.ditto.model.things.Thing#ID_REGEX}. */ public static RetrieveAttributes fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new CommandJsonDeserializer<RetrieveAttributes>(TYPE, jsonObject).deserialize(() -> { final String thingId = jsonObject.getValueOrThrow(ThingQueryCommand.JsonFields.JSON_THING_ID); final JsonFieldSelector extractedFieldSelector = jsonObject.getValue(JSON_SELECTED_FIELDS) .map(str -> JsonFactory.newFieldSelector(str, JsonFactory.newParseOptionsBuilder() .withoutUrlDecoding() .build())) .orElse(null); return of(thingId, extractedFieldSelector, dittoHeaders); }); }
/** * Creates a new {@code RetrieveFeatures} from a JSON object. * * @param jsonObject the JSON object of which the command is to be created. * @param dittoHeaders the headers of the command. * @return the command. * @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. * @throws org.eclipse.ditto.model.things.ThingIdInvalidException if the parsed thing ID did not comply to {@link * org.eclipse.ditto.model.things.Thing#ID_REGEX}. */ public static RetrieveFeatures fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new CommandJsonDeserializer<RetrieveFeatures>(TYPE, jsonObject).deserialize(() -> { final String thingId = jsonObject.getValueOrThrow(ThingQueryCommand.JsonFields.JSON_THING_ID); final JsonFieldSelector extractedFieldSelector = jsonObject.getValue(JSON_SELECTED_FIELDS) .map(str -> JsonFactory.newFieldSelector(str, JsonFactory.newParseOptionsBuilder() .withoutUrlDecoding() .build())) .orElse(null); return of(thingId, extractedFieldSelector, dittoHeaders); }); }
/** * Creates a new {@code RetrieveThing} from a JSON object. * * @param jsonObject the JSON object of which the command is to be created. * @param dittoHeaders the headers of the command. * @return the command. * @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 * format. */ public static RetrieveThing fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new CommandJsonDeserializer<RetrieveThing>(TYPE, jsonObject).deserialize(() -> { final String thingId = jsonObject.getValueOrThrow(ThingQueryCommand.JsonFields.JSON_THING_ID); final Builder builder = getBuilder(thingId, dittoHeaders); jsonObject.getValue(JSON_SELECTED_FIELDS) .map(str -> JsonFactory.newFieldSelector(str, JsonFactory.newParseOptionsBuilder() .withoutUrlDecoding() .build())) .ifPresent(builder::withSelectedFields); jsonObject.getValue(JSON_SNAPSHOT_REVISION).ifPresent(builder::withSnapshotRevision); return builder.build(); }); }
/** * Creates a new {@code RetrieveFeatureProperties} from a JSON object. * * @param jsonObject the JSON object of which the command is to be created. * @param dittoHeaders the headers of the command. * @return the command. * @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. * @throws org.eclipse.ditto.model.things.ThingIdInvalidException if the parsed thing ID did not comply to {@link * org.eclipse.ditto.model.things.Thing#ID_REGEX}. */ public static RetrieveFeatureProperties fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new CommandJsonDeserializer<RetrieveFeatureProperties>(TYPE, jsonObject).deserialize(() -> { final String thingId = jsonObject.getValueOrThrow(ThingQueryCommand.JsonFields.JSON_THING_ID); final String extractedFeatureId = jsonObject.getValueOrThrow(JSON_FEATURE_ID); final JsonFieldSelector extractedFieldSelector = jsonObject.getValue(JSON_SELECTED_FIELDS) .map(str -> JsonFactory.newFieldSelector(str, JsonFactory.newParseOptionsBuilder() .withoutUrlDecoding() .build())) .orElse(null); return of(thingId, extractedFeatureId, extractedFieldSelector, dittoHeaders); }); }
/** * Creates a new {@code RetrieveThing} from a JSON object. * * @param jsonObject the JSON object of which the command is to be created. * @param dittoHeaders the headers of the command. * @return the command. * @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 * format. */ public static RetrieveThing fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new CommandJsonDeserializer<RetrieveThing>(TYPE, jsonObject).deserialize(() -> { final String thingId = jsonObject.getValueOrThrow(ThingQueryCommand.JsonFields.JSON_THING_ID); final Builder builder = getBuilder(thingId, dittoHeaders); jsonObject.getValue(JSON_SELECTED_FIELDS) .map(str -> JsonFactory.newFieldSelector(str, JsonFactory.newParseOptionsBuilder() .withoutUrlDecoding() .build())) .ifPresent(builder::withSelectedFields); jsonObject.getValue(JSON_SNAPSHOT_REVISION).ifPresent(builder::withSnapshotRevision); return builder.build(); }); }
/** * Creates a new {@code RetrieveFeature} from a JSON object. * * @param jsonObject the JSON object of which the command is to be created. * @param dittoHeaders the headers of the command. * @return the command. * @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. * @throws org.eclipse.ditto.model.things.ThingIdInvalidException if the parsed thing ID did not comply to {@link * org.eclipse.ditto.model.things.Thing#ID_REGEX}. */ public static RetrieveFeature fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new CommandJsonDeserializer<RetrieveFeature>(TYPE, jsonObject).deserialize(() -> { final String thingId = jsonObject.getValueOrThrow(ThingQueryCommand.JsonFields.JSON_THING_ID); final String extractedFeatureId = jsonObject.getValueOrThrow(JSON_FEATURE_ID); final JsonFieldSelector extractedFieldSelector = jsonObject.getValue(JSON_SELECTED_FIELDS) .map(str -> JsonFactory.newFieldSelector(str, JsonFactory.newParseOptionsBuilder() .withoutUrlDecoding() .build())) .orElse(null); return of(thingId, extractedFeatureId, extractedFieldSelector, dittoHeaders); }); }
/** * Creates a new {@code RetrieveFeature} from a JSON object. * * @param jsonObject the JSON object of which the command is to be created. * @param dittoHeaders the headers of the command. * @return the command. * @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. * @throws org.eclipse.ditto.model.things.ThingIdInvalidException if the parsed thing ID did not comply to {@link * org.eclipse.ditto.model.things.Thing#ID_REGEX}. */ public static RetrieveFeature fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new CommandJsonDeserializer<RetrieveFeature>(TYPE, jsonObject).deserialize(() -> { final String thingId = jsonObject.getValueOrThrow(ThingQueryCommand.JsonFields.JSON_THING_ID); final String extractedFeatureId = jsonObject.getValueOrThrow(JSON_FEATURE_ID); final JsonFieldSelector extractedFieldSelector = jsonObject.getValue(JSON_SELECTED_FIELDS) .map(str -> JsonFactory.newFieldSelector(str, JsonFactory.newParseOptionsBuilder() .withoutUrlDecoding() .build())) .orElse(null); return of(thingId, extractedFeatureId, extractedFieldSelector, dittoHeaders); }); }
/** * Creates a new {@code RetrieveFeatureProperties} from a JSON object. * * @param jsonObject the JSON object of which the command is to be created. * @param dittoHeaders the headers of the command. * @return the command. * @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. * @throws org.eclipse.ditto.model.things.ThingIdInvalidException if the parsed thing ID did not comply to {@link * org.eclipse.ditto.model.things.Thing#ID_REGEX}. */ public static RetrieveFeatureProperties fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new CommandJsonDeserializer<RetrieveFeatureProperties>(TYPE, jsonObject).deserialize(() -> { final String thingId = jsonObject.getValueOrThrow(ThingQueryCommand.JsonFields.JSON_THING_ID); final String extractedFeatureId = jsonObject.getValueOrThrow(JSON_FEATURE_ID); final JsonFieldSelector extractedFieldSelector = jsonObject.getValue(JSON_SELECTED_FIELDS) .map(str -> JsonFactory.newFieldSelector(str, JsonFactory.newParseOptionsBuilder() .withoutUrlDecoding() .build())) .orElse(null); return of(thingId, extractedFeatureId, extractedFieldSelector, dittoHeaders); }); }