@Override public boolean isEmpty() { return wrapped.isEmpty(); }
@Override public boolean isEmpty() { return wrapped.isEmpty(); }
@Override public boolean isEmpty() { return wrapped.isEmpty(); }
@Override public boolean isEmpty() { return wrapped.isEmpty(); }
private static List<PointerAndValue> collectFlatPointers(final JsonPointer createdPointer, final JsonField field, final List<PointerAndValue> flattenedFields) { final JsonValue fieldValue = field.getValue(); if (fieldValue.isObject()) { final JsonObject jsonObject = fieldValue.asObject(); if (!jsonObject.isEmpty()) { jsonObject.forEach(jsonField -> collectFlatPointers(createdPointer.addLeaf(jsonField.getKey()), jsonField, flattenedFields)); } else { flattenedFields.add(new PointerAndValue(createdPointer, fieldValue)); } } else { flattenedFields.add(new PointerAndValue(createdPointer, fieldValue)); } return flattenedFields; }
@Override public FromScratch setAttributes(final JsonObject attributesJsonObject) { checkNotNull(attributesJsonObject, "JSON object representation of Attributes to be set"); if (attributesJsonObject.isNull()) { return setNullAttributes(); } else if (attributesJsonObject.isEmpty()) { return setEmptyAttributes(); } return setAttributes(ThingsModelFactory.newAttributes(attributesJsonObject)); }
@Override public FromScratch setAttributes(final JsonObject attributesJsonObject) { checkNotNull(attributesJsonObject, "JSON object representation of Attributes to be set"); if (attributesJsonObject.isNull()) { return setNullAttributes(); } else if (attributesJsonObject.isEmpty()) { return setEmptyAttributes(); } return setAttributes(ThingsModelFactory.newAttributes(attributesJsonObject)); }
.filter(thingJson -> !thingJson.isEmpty()) // avoid sending back empty jsonValues .map(jsonValue -> ServerSentEvent.create(jsonValue.toString())) .keepAlive(Duration.ofSeconds(1), ServerSentEvent::heartbeat);
private static void validate(final CharSequence jsonKey, final JsonValue jsonValue) { checkNotNull(jsonKey, "JSON key"); checkNotNull(jsonValue, "JSON value"); final String msgTemplate = "Expected for Authorization Subject ''{0}'' a JSON object containing all of {1}" + " but got <{2}>!"; final Supplier<String> descriptionSupplier = () -> MessageFormat.format(msgTemplate, jsonKey, Permission.allToString(), jsonValue); if (!jsonValue.isObject()) { throw new DittoJsonException(JsonParseException.newBuilder() // .description(descriptionSupplier) // .build()); } final JsonObject permissionsJsonObject = jsonValue.asObject(); if (permissionsJsonObject.isEmpty()) { throw AclEntryInvalidException.newBuilder() // .description(descriptionSupplier) // .build(); } }
private static void validate(final CharSequence jsonKey, final JsonValue jsonValue) { checkNotNull(jsonKey, "JSON key"); checkNotNull(jsonValue, "JSON value"); final String msgTemplate = "Expected for Authorization Subject ''{0}'' a JSON object containing all of {1}" + " but got <{2}>!"; final Supplier<String> descriptionSupplier = () -> MessageFormat.format(msgTemplate, jsonKey, Permission.allToString(), jsonValue); if (!jsonValue.isObject()) { throw new DittoJsonException(JsonParseException.newBuilder() // .description(descriptionSupplier) // .build()); } final JsonObject permissionsJsonObject = jsonValue.asObject(); if (permissionsJsonObject.isEmpty()) { throw AclEntryInvalidException.newBuilder() // .description(descriptionSupplier) // .build(); } }