private static JsonObject renameField(final CharSequence oldFieldName, final CharSequence newFieldName, final JsonObject jsonObject) { return jsonObject.getValue(oldFieldName) .map(value -> jsonObject.setValue(newFieldName, value)) .orElse(jsonObject); }
@Override public FeatureProperties setValue(final CharSequence key, final JsonValue value) { return determineResult(() -> wrapped.setValue(key, value)); }
@Override public Attributes setValue(final CharSequence key, final JsonValue value) { return determineResult(() -> wrapped.setValue(key, value)); }
private static JsonObject renameField(final CharSequence oldFieldName, final CharSequence newFieldName, final JsonObject jsonObject) { return jsonObject.getValue(oldFieldName) .map(value -> jsonObject.setValue(newFieldName, value)) .orElse(jsonObject); }
@Override public FeatureProperties setValue(final CharSequence key, final JsonValue value) { return determineResult(() -> wrapped.setValue(key, value)); }
@SuppressWarnings("squid:CallToDeprecatedMethod") private static JsonObject migrateId(final JsonObject jsonObject) { return jsonObject.getValue(Event.JsonFields.ID) .map(name -> name.replaceFirst("thing", "")) .map(Introspector::decapitalize) .map(name -> ThingEvent.TYPE_PREFIX + name) .map(JsonValue::of) .map(type -> jsonObject.setValue(Event.JsonFields.TYPE.getPointer(), type)) .orElse(jsonObject); }
@SuppressWarnings("squid:CallToDeprecatedMethod") private static JsonObject migrateId(final JsonObject jsonObject) { return jsonObject.getValue(Event.JsonFields.ID) .map(name -> name.replaceFirst("thing", "")) .map(Introspector::decapitalize) .map(name -> ThingEvent.TYPE_PREFIX + name) .map(JsonValue::of) .map(type -> jsonObject.setValue(Event.JsonFields.TYPE.getPointer(), type)) .orElse(jsonObject); }
@Override public Attributes setValue(final CharSequence name, final int value) { return ImmutableAttributes.of(JsonFactory.newObject().setValue(name, value)); }
@Override public Attributes setValue(final CharSequence name, final double value) { return ImmutableAttributes.of(JsonFactory.newObject().setValue(name, value)); }
@Override public Attributes setValue(final CharSequence name, final String value) { return ImmutableAttributes.of(JsonFactory.newObject().setValue(name, value)); }
@Override public Attributes setValue(final CharSequence key, final boolean value) { return ImmutableAttributes.of(JsonFactory.newObject().setValue(key, value)); }
@Override public Attributes setValue(final CharSequence name, final JsonValue value) { return ImmutableAttributes.of(JsonFactory.newObject().setValue(name, value)); }
@Override protected JsonObject convertToJson(final ThingWithSnapshotTag snapshotEntity) { final JsonObject jsonObject = super.convertToJson(snapshotEntity); final SnapshotTag snapshotTag = snapshotEntity.getSnapshotTag(); return jsonObject.setValue(TAG_JSON_KEY, snapshotTag.name()); }
@Override protected JsonObject convertToJson(final ThingWithSnapshotTag snapshotEntity) { final JsonObject jsonObject = super.convertToJson(snapshotEntity); final SnapshotTag snapshotTag = snapshotEntity.getSnapshotTag(); return jsonObject.setValue(TAG_JSON_KEY, snapshotTag.name()); }
private T parseEvent(final JsonValue jsonValue) { final JsonObject jsonObject = jsonValue.asObject() .setValue(Event.JsonFields.REVISION.getPointer(), Event.DEFAULT_REVISION); return eventRegistry.parse(jsonObject, DittoHeaders.empty()); }
private T parseEvent(final JsonValue jsonValue) { final JsonObject jsonObject = jsonValue.asObject() .setValue(Event.JsonFields.REVISION.getPointer(), Event.DEFAULT_REVISION); return eventRegistry.parse(jsonObject, DittoHeaders.empty()); }
private PolicyEvent createEventFrom(final JsonValue json) { final JsonObject jsonObject = json.asObject() .setValue(Event.JsonFields.REVISION.getPointer(), Event.DEFAULT_REVISION); return eventRegistry.parse(migrateComplex(migratePayload(jsonObject)), DittoHeaders.empty()); }
private Event createEventFrom(final JsonValue json) { final JsonObject jsonObject = json.asObject() .setValue(Event.JsonFields.REVISION.getPointer(), Event.DEFAULT_REVISION); return eventRegistry.parse(migrateComplex(migratePayload(jsonObject)), DittoHeaders.empty()); }
private Event createEventFrom(final JsonValue json) { final JsonObject jsonObject = json.asObject() .setValue(Event.JsonFields.REVISION.getPointer(), Event.DEFAULT_REVISION); return eventRegistry.parse(migrateComplex(migratePayload(jsonObject)), DittoHeaders.empty()); }
private PolicyEvent createEventFrom(final JsonValue json) { final JsonObject jsonObject = json.asObject() .setValue(Event.JsonFields.REVISION.getPointer(), Event.DEFAULT_REVISION); return eventRegistry.parse(migrateComplex(migratePayload(jsonObject)), DittoHeaders.empty()); }