public final class JsonPatch extends Object
Modifier and Type | Field and Description |
---|---|
static JsonPointer |
FROM_PTR
Path to the "from" attribute of a patch entry.
|
static String |
MEDIA_TYPE
Internet media type for the JSON Patch format.
|
static JsonPointer |
OP_PTR
Path to the "op" attribute of a patch entry.
|
static JsonPointer |
PATH_PTR
Path to the "path" attribute of a patch entry.
|
static JsonPointer |
VALUE_PTR
Path to the "value" attribute of a patch entry.
|
Modifier and Type | Method and Description |
---|---|
static JsonValue |
diff(JsonValue original,
JsonValue target)
Compares two JSON values, and produces a JSON Patch value, which contains the
operations necessary to modify the
original value to arrive at the
target value. |
static boolean |
isEqual(JsonValue value,
JsonValue other)
Compares two JSON values, and returns whether the two objects are identical.
|
static void |
patch(JsonValue original,
JsonValue patch)
Applies a set of modifications in a JSON patch value to an original value, resulting
in the intended target value.
|
static void |
patch(JsonValue original,
JsonValue patch,
JsonPatchValueTransformer transform)
Applies a set of modifications in a JSON patch value to an original value, resulting
in the intended target value.
|
public static final String MEDIA_TYPE
public static final JsonPointer OP_PTR
public static final JsonPointer PATH_PTR
public static final JsonPointer FROM_PTR
public static final JsonPointer VALUE_PTR
JsonPatchValueTransformer
.public static JsonValue diff(JsonValue original, JsonValue target)
original
value to arrive at the
target
value.original
- the original value.target
- the intended target value.NullPointerException
- if either of original
or target
are null
.public static boolean isEqual(JsonValue value, JsonValue other)
false
is returned as soon as a difference is detected.value
- a value.other
- another value.NullPointerException
- if either of value
or other
are null
.IllegalArgumentException
- if the JsonValue
contains non-JSON primitive values.public static void patch(JsonValue original, JsonValue patch)
original
- the original value on which to apply the modifications.patch
- the JSON Patch value, specifying the modifications to apply to the original value.JsonValueException
- if application of the patch failed.public static void patch(JsonValue original, JsonValue patch, JsonPatchValueTransformer transform)
original
- the original value on which to apply the modifications.patch
- the JSON Patch value, specifying the modifications to apply to the original value.transform
- a custom transform used to determine the target value.JsonValueException
- if application of the patch failed.Copyright © 2025 Open Identity Platform Community. All rights reserved.