/** * Creates a new {@code SudoRetrieveThings}. * * @param thingIds one or more Thing IDs to be retrieved. * @param dittoHeaders the command headers of the request. * @return a command for retrieving Things without authorization. * @throws NullPointerException if any argument is {@code null}. */ public static SudoRetrieveThings of(final List<String> thingIds, final DittoHeaders dittoHeaders) { return of(thingIds, null, dittoHeaders); }
/** * Creates a new {@code SudoRetrieveThings}. * * @param thingIds one or more Thing IDs to be retrieved. * @param dittoHeaders the command headers of the request. * @return a command for retrieving Things without authorization. * @throws NullPointerException if any argument is {@code null}. */ public static SudoRetrieveThings of(final List<String> thingIds, final DittoHeaders dittoHeaders) { return of(thingIds, null, dittoHeaders); }
@Override public SudoRetrieveThings setDittoHeaders(final DittoHeaders dittoHeaders) { return of(thingIds, selectedFields, dittoHeaders); }
@Override public SudoRetrieveThings setDittoHeaders(final DittoHeaders dittoHeaders) { return of(thingIds, selectedFields, 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 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); }