public interface JsonPatchBuilder
The following illustrates the approach.
JsonPatchBuilder builder = Json.createPatchBuilder(); JsonPatch patch = builder.add("/John/phones/office", "1234-567") .remove("/Amy/age") .build();The result is equivalent to the following JSON Patch.
[ {"op" = "add", "path" = "/John/phones/office", "value" = "1234-567"}, {"op" = "remove", "path" = "/Amy/age"} ]
Modifier and Type | Method and Description |
---|---|
JsonPatchBuilder |
add(java.lang.String path,
boolean value)
Adds an "add" JSON Patch operation.
|
JsonPatchBuilder |
add(java.lang.String path,
int value)
Adds an "add" JSON Patch operation.
|
JsonPatchBuilder |
add(java.lang.String path,
JsonValue value)
Adds an "add" JSON Patch operation.
|
JsonPatchBuilder |
add(java.lang.String path,
java.lang.String value)
Adds an "add" JSON Patch operation.
|
JsonPatch |
build()
Returns the JSON Patch.
|
JsonPatchBuilder |
copy(java.lang.String path,
java.lang.String from)
Adds a "copy" JSON Patch operation.
|
JsonPatchBuilder |
move(java.lang.String path,
java.lang.String from)
Adds a "move" JSON Patch operation.
|
JsonPatchBuilder |
remove(java.lang.String path)
Adds a "remove" JSON Patch operation.
|
JsonPatchBuilder |
replace(java.lang.String path,
boolean value)
Adds a "replace" JSON Patch operation.
|
JsonPatchBuilder |
replace(java.lang.String path,
int value)
Adds a "replace" JSON Patch operation.
|
JsonPatchBuilder |
replace(java.lang.String path,
JsonValue value)
Adds a "replace" JSON Patch operation.
|
JsonPatchBuilder |
replace(java.lang.String path,
java.lang.String value)
Adds a "replace" JSON Patch operation.
|
JsonPatchBuilder |
test(java.lang.String path,
boolean value)
Adds a "test" JSON Patch operation.
|
JsonPatchBuilder |
test(java.lang.String path,
int value)
Adds a "test" JSON Patch operation.
|
JsonPatchBuilder |
test(java.lang.String path,
JsonValue value)
Adds a "test" JSON Patch operation.
|
JsonPatchBuilder |
test(java.lang.String path,
java.lang.String value)
Adds a "test" JSON Patch operation.
|
JsonPatchBuilder add(java.lang.String path, JsonValue value)
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer.value
- the "value" member of the operationJsonPatchBuilder add(java.lang.String path, java.lang.String value)
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer.value
- the "value" member of the operationJsonPatchBuilder add(java.lang.String path, int value)
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer.value
- the "value" member of the operationJsonPatchBuilder add(java.lang.String path, boolean value)
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer.value
- the "value" member of the operationJsonPatchBuilder remove(java.lang.String path)
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer.JsonPatchBuilder replace(java.lang.String path, JsonValue value)
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer.value
- the "value" member of the operationJsonPatchBuilder replace(java.lang.String path, java.lang.String value)
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer string.value
- the "value" member of the operationJsonPatchBuilder replace(java.lang.String path, int value)
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer string.value
- the "value" member of the operationJsonPatchBuilder replace(java.lang.String path, boolean value)
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer string.value
- the "value" member of the operationJsonPatchBuilder move(java.lang.String path, java.lang.String from)
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer string.from
- the "from" member of the operationJsonPatchBuilder copy(java.lang.String path, java.lang.String from)
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer string.from
- the "from" member of the operationJsonPatchBuilder test(java.lang.String path, JsonValue value)
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer string.value
- the "value" member of the operationJsonPatchBuilder test(java.lang.String path, java.lang.String value)
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer string.value
- the "value" member of the operationJsonPatchBuilder test(java.lang.String path, int value)
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer string.value
- the "value" member of the operationJsonPatchBuilder test(java.lang.String path, boolean value)
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer string.value
- the "value" member of the operationJsonPatch build()