public interface JsonPatchBuilder
JsonPatches.
To get an instance use Json.createPatchBuilder() or Json.createPatchBuilder(JsonArray)
The order of the operations corresponds to the order they are builded.
NOTICE: A JsonPatchBuilder contains state and therefore is NOT threadsafe and should not be used concurrently.
The following JsonPatch
"[
{
"op": "add",
"path": "/add/object",
"value": {
"foo": "bar"
}
},
{
"op": "remove",
"path": "/remove/it"
},
{
"op": "move",
"path": "move/to",
"from": "move/from"
}
]"
can be build with the JsonPatchBuilder
JsonPatch patch = Json.createJsonPatchBuilder()
.add("/add/object", Json.createObjectBuilder()
.add("foo", "bar")
.build())
.remove("/remove/it")
.move("/move/to", "move/from")
.build();
An instance of a JsonPatchBuilder can be reused for another JsonPatch after
the build()-Method was called.
JsonPatchBuilder add(String path, JsonValue value)
JsonPatchpath - as JsonPointer where the value should be addedvalue - the value to addNullPointerException - if the given path is nullJsonPatchBuilder add(String path, String value)
add(String, JsonValue)JsonPatchBuilder add(String path, int value)
add(String, JsonValue)JsonPatchBuilder add(String path, boolean value)
add(String, JsonValue)JsonPatchBuilder remove(String path)
JsonPatchpath - as JsonPointer of the value which should get removedNullPointerException - if the given path is nullJsonPatchBuilder replace(String path, JsonValue value)
JsonPatchpath - as JsonPointer to the value which should get replacedvalue - the new valueNullPointerException - if the given path is nullJsonPatchBuilder replace(String path, String value)
replace(String, JsonValue)JsonPatchBuilder replace(String path, int value)
replace(String, JsonValue)JsonPatchBuilder replace(String path, boolean value)
replace(String, JsonValue)JsonPatchBuilder move(String path, String from)
JsonPatchpath - where the value should get inserted as JsonPointerfrom - where the value should be taken from as JsonPointerNullPointerException - if the given path is null
if the given from is nullJsonPatchBuilder copy(String path, String from)
JsonPatchpath - where the copied value should get inserted as JsonPointerfrom - value to copy as JsonPointerNullPointerException - if the given path is null
if the given from is nullJsonPatchBuilder test(String path, JsonValue value)
JsonPointerpath - as JsonPointer to the value to testvalue - value to testNullPointerException - if the given path is nullJsonPatchBuilder test(String path, String value)
test(String, JsonValue)JsonPatchBuilder test(String path, int value)
test(String, JsonValue)JsonPatchBuilder test(String path, boolean value)
test(String, JsonValue)JsonPatch build()
Copyright © 2010 - 2020 Adobe. All Rights Reserved