public interface JsonPatchBuilder
JsonPatch
es.
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)
JsonPatch
path
- as JsonPointer
where the value should be addedvalue
- the value to addNullPointerException
- if the given path
is null
JsonPatchBuilder 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)
JsonPatch
path
- as JsonPointer
of the value which should get removedNullPointerException
- if the given path
is null
JsonPatchBuilder replace(String path, JsonValue value)
JsonPatch
path
- as JsonPointer
to the value which should get replacedvalue
- the new valueNullPointerException
- if the given path
is null
JsonPatchBuilder 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)
JsonPatch
path
- where the value should get inserted as JsonPointer
from
- where the value should be taken from as JsonPointer
NullPointerException
- if the given path
is null
if the given from
is null
JsonPatchBuilder copy(String path, String from)
JsonPatch
path
- where the copied value should get inserted as JsonPointer
from
- value to copy as JsonPointer
NullPointerException
- if the given path
is null
if the given from
is null
JsonPatchBuilder test(String path, JsonValue value)
JsonPointer
path
- as JsonPointer
to the value to testvalue
- value to testNullPointerException
- if the given path
is null
JsonPatchBuilder 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