Package javax.json
Interface JsonPatchBuilder
-
public interface JsonPatchBuilder
A builder for constructing a JSON Patch as defined by RFC 6902 by adding JSON Patch operations incrementally.
This is a near-exact copy of the same-titled Java EE 8 Class:javax.json.JsonPatchBuilder
Commenting has been slightly modified to accompany HiLiting the Code Examples.
Java Source Code remains identical to the Sun-Oracle & 'GlassFish' Released Distributions.
Read included License:HERE
, and theCDDL+GPL-1.1
Alljavax.json.*
Code Obtained From:GitHub JavaEE jsonp
Public Archive.
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:
- RFC 6902
Hi-Lited Source-Code:This File's Source Code:
- View Here: javax/json/JsonPatchBuilder.java
- Open New Browser-Tab: javax/json/JsonPatchBuilder.java
File Size: 7,823 Bytes Line Count: 220 '\n' Characters Found
Glass Fish Implementation Class:
- View Here: org/glassfish/json/JsonPatchBuilderImpl.java
- Open New Browser-Tab: org/glassfish/json/JsonPatchBuilderImpl.java
File Size: 12,440 Bytes Line Count: 362 '\n' Characters Found
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description JsonPatchBuilder
add(String path, boolean value)
Adds an "add" JSON Patch operation.JsonPatchBuilder
add(String path, int value)
Adds an "add" JSON Patch operation.JsonPatchBuilder
add(String path, String value)
Adds an "add" JSON Patch operation.JsonPatchBuilder
add(String path, JsonValue value)
Adds an "add" JSON Patch operation.JsonPatch
build()
Returns the JSON Patch.JsonPatchBuilder
copy(String path, String from)
Adds a "copy" JSON Patch operation.JsonPatchBuilder
move(String path, String from)
Adds a "move" JSON Patch operation.JsonPatchBuilder
remove(String path)
Adds a "remove" JSON Patch operation.JsonPatchBuilder
replace(String path, boolean value)
Adds a "replace" JSON Patch operation.JsonPatchBuilder
replace(String path, int value)
Adds a "replace" JSON Patch operation.JsonPatchBuilder
replace(String path, String value)
Adds a "replace" JSON Patch operation.JsonPatchBuilder
replace(String path, JsonValue value)
Adds a "replace" JSON Patch operation.JsonPatchBuilder
test(String path, boolean value)
Adds a "test" JSON Patch operation.JsonPatchBuilder
test(String path, int value)
Adds a "test" JSON Patch operation.JsonPatchBuilder
test(String path, String value)
Adds a "test" JSON Patch operation.JsonPatchBuilder
test(String path, JsonValue value)
Adds a "test" JSON Patch operation.
-
-
-
Method Detail
-
add
JsonPatchBuilder add(java.lang.String path, JsonValue value)
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
JsonPatchBuilder add(java.lang.String path, java.lang.String value)
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
JsonPatchBuilder add(java.lang.String path, int value)
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
JsonPatchBuilder add(java.lang.String path, boolean value)
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
JsonPatchBuilder remove(java.lang.String path)
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
JsonPatchBuilder replace(java.lang.String path, JsonValue value)
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
JsonPatchBuilder replace(java.lang.String path, java.lang.String value)
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
JsonPatchBuilder replace(java.lang.String path, int value)
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
JsonPatchBuilder replace(java.lang.String path, boolean value)
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
JsonPatchBuilder move(java.lang.String path, java.lang.String from)
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
JsonPatchBuilder copy(java.lang.String path, java.lang.String from)
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
JsonPatchBuilder test(java.lang.String path, JsonValue value)
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
JsonPatchBuilder test(java.lang.String path, java.lang.String value)
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
JsonPatchBuilder test(java.lang.String path, int value)
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
JsonPatchBuilder test(java.lang.String path, boolean value)
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
-
-