public interface JsonPatchBuilder
A builder for constructing a JSON Patch as defined by
RFC 6902 by adding
JSON Patch operations incrementally.
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"} ]
- Since:
- 1.1
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionAdds an "add" JSON Patch operation.Adds an "add" JSON Patch operation.Adds an "add" JSON Patch operation.Adds an "add" JSON Patch operation.build()
Returns the JSON Patch.Adds a "copy" JSON Patch operation.Adds a "move" JSON Patch operation.Adds a "remove" JSON Patch operation.Adds a "replace" JSON Patch operation.Adds a "replace" JSON Patch operation.Adds a "replace" JSON Patch operation.Adds a "replace" JSON Patch operation.Adds a "test" JSON Patch operation.Adds a "test" JSON Patch operation.Adds a "test" JSON Patch operation.Adds a "test" JSON Patch operation.
-
Method Details
-
add
Adds an "add" JSON Patch operation.- Parameters:
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer.value
- the "value" member of the operation- Returns:
- this JsonPatchBuilder
-
add
Adds an "add" JSON Patch operation.- Parameters:
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer.value
- the "value" member of the operation- Returns:
- this JsonPatchBuilder
-
add
Adds an "add" JSON Patch operation.- Parameters:
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer.value
- the "value" member of the operation- Returns:
- this JsonPatchBuilder
-
add
Adds an "add" JSON Patch operation.- Parameters:
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer.value
- the "value" member of the operation- Returns:
- this JsonPatchBuilder
-
remove
Adds a "remove" JSON Patch operation.- Parameters:
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer.- Returns:
- this JsonPatchBuilder
-
replace
Adds a "replace" JSON Patch operation.- Parameters:
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer.value
- the "value" member of the operation- Returns:
- this JsonPatchBuilder
-
replace
Adds a "replace" JSON Patch operation.- Parameters:
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer string.value
- the "value" member of the operation- Returns:
- this JsonPatchBuilder
-
replace
Adds a "replace" JSON Patch operation.- Parameters:
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer string.value
- the "value" member of the operation- Returns:
- this JsonPatchBuilder
-
replace
Adds a "replace" JSON Patch operation.- Parameters:
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer string.value
- the "value" member of the operation- Returns:
- this JsonPatchBuilder
-
move
Adds a "move" JSON Patch operation.- Parameters:
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer string.from
- the "from" member of the operation- Returns:
- this JsonPatchBuilder
-
copy
Adds a "copy" JSON Patch operation.- Parameters:
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer string.from
- the "from" member of the operation- Returns:
- this JsonPatchBuilder
-
test
Adds a "test" JSON Patch operation.- Parameters:
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer string.value
- the "value" member of the operation- Returns:
- this JsonPatchBuilder
-
test
Adds a "test" JSON Patch operation.- Parameters:
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer string.value
- the "value" member of the operation- Returns:
- this JsonPatchBuilder
-
test
Adds a "test" JSON Patch operation.- Parameters:
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer string.value
- the "value" member of the operation- Returns:
- this JsonPatchBuilder
-
test
Adds a "test" JSON Patch operation.- Parameters:
path
- the "path" member of the operation. Must be a valid escaped JSON-Pointer string.value
- the "value" member of the operation- Returns:
- this JsonPatchBuilder
-
build
-