public interface JsonMergePatch
このインターフェースは、RFC 7396 で定義された JSON マージパッチの実装を表します。
JsonMergePatch
は、Json.createMergePatch(JsonValue)
でインスタンス化できます。これには、JSON マージパッチでパッチ操作を指定するか、Json.createMergeDiff(JsonValue, JsonValue)
を使用して、2 つの JsonValue
の違いに基づいて JSON マージパッチを作成します。
1. 既存の JSON マージパッチを使用して JsonMergePatch を構築します。
JsonValue contacts = ... ; // The target to be patched
JsonValue patch = ... ; // JSON Merge Patch
JsonMergePatch mergePatch = Json.createMergePatch(patch);
JsonValue result = mergePatch.apply(contacts);
2. 2 つの JsonValue
の差から JsonMergePatch を構築します。
JsonValue source = ... ; // The source object
JsonValue target = ... ; // The modified object
JsonMergePatch mergePatch = Json.createMergeDiff(source, target); // The diff between source and target in a Json Merge Patch format
修飾子と型 | メソッドと説明 |
---|---|
JsonValue | apply(JsonValue target) 指定した target に JSON マージパッチを適用します。 |
JsonValue | toJsonValue() JsonMergePatch を JsonValue として返します。 |
Copyright © 2019 Eclipse Foundation.
Use is subject to license terms.