org.eclipse.ditto.json.JsonObject.setValue()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中org.eclipse.ditto.json.JsonObject.setValue()方法的一些代码示例,展示了JsonObject.setValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonObject.setValue()方法的具体详情如下:
包路径:org.eclipse.ditto.json.JsonObject
类名称:JsonObject
方法名:setValue

JsonObject.setValue介绍

[英]Creates a new JSON object by setting a new JSON field with the specified key and the JSON representation of the specified double value to the new object. If this object previously contained a field with the same key, the old field is replaced by the new field in the new object.
[中]通过将具有指定键的新JSON字段和指定双精度值的JSON表示形式设置为新对象来创建新JSON对象。如果此对象以前包含具有相同键的字段,则新对象中的新字段将替换旧字段。

代码示例

代码示例来源:origin: eclipse/ditto

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);
}

代码示例来源:origin: eclipse/ditto

@Override
public FeatureProperties setValue(final CharSequence key, final JsonValue value) {
  return determineResult(() -> wrapped.setValue(key, value));
}

代码示例来源:origin: eclipse/ditto

@Override
public Attributes setValue(final CharSequence key, final JsonValue value) {
  return determineResult(() -> wrapped.setValue(key, value));
}

代码示例来源:origin: org.eclipse.ditto/ditto-services-things-persistence

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);
}

代码示例来源:origin: org.eclipse.ditto/ditto-model-things

@Override
public FeatureProperties setValue(final CharSequence key, final JsonValue value) {
  return determineResult(() -> wrapped.setValue(key, value));
}

代码示例来源:origin: eclipse/ditto

@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);
}

代码示例来源:origin: org.eclipse.ditto/ditto-services-things-persistence

@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);
}

代码示例来源:origin: org.eclipse.ditto/ditto-model-things

@Override
public Attributes setValue(final CharSequence name, final int value) {
  return ImmutableAttributes.of(JsonFactory.newObject().setValue(name, value));
}

代码示例来源:origin: org.eclipse.ditto/ditto-model-things

@Override
public Attributes setValue(final CharSequence name, final double value) {
  return ImmutableAttributes.of(JsonFactory.newObject().setValue(name, value));
}

代码示例来源:origin: org.eclipse.ditto/ditto-model-things

@Override
public Attributes setValue(final CharSequence name, final String value) {
  return ImmutableAttributes.of(JsonFactory.newObject().setValue(name, value));
}

代码示例来源:origin: org.eclipse.ditto/ditto-model-things

@Override
public Attributes setValue(final CharSequence key, final boolean value) {
  return ImmutableAttributes.of(JsonFactory.newObject().setValue(key, value));
}

代码示例来源:origin: org.eclipse.ditto/ditto-model-things

@Override
public Attributes setValue(final CharSequence name, final JsonValue value) {
  return ImmutableAttributes.of(JsonFactory.newObject().setValue(name, value));
}

代码示例来源:origin: org.eclipse.ditto/ditto-services-things-persistence

@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());
}

代码示例来源:origin: eclipse/ditto

@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());
}

代码示例来源:origin: eclipse/ditto

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());
}

代码示例来源:origin: org.eclipse.ditto/ditto-services-utils-persistence

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());
}

代码示例来源:origin: org.eclipse.ditto/ditto-services-policies-persistence

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());
}

代码示例来源:origin: org.eclipse.ditto/ditto-services-things-persistence

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());
}

代码示例来源:origin: eclipse/ditto

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());
}

代码示例来源:origin: eclipse/ditto

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());
}

相关文章