public static enum JsonPatch.Operation extends Enum<JsonPatch.Operation>
An enumeration of available operations for JsonPatch.
NOTICE: the behavoir of some operations depends on which JsonValue they are performed.
for details please check the documentation of the very operation.
| Enum Constant and Description |
|---|
ADD
required members are:
"op": "add"
"path": "path/to/add"
"value": "
JsonValueToAdd"
|
COPY
required members are:
"op": "copy"
"from": "path/to/copy/from"
"path": "path/to/add"
|
MOVE
required members are:
"op": "move"
"from": "path/to/move/from"
"path": "path/to/move/to"
|
REMOVE
required members are:
"op": "remove"
"path": "path/to/remove"
|
REPLACE
required members are:
"op": "replace"
"path": "path/to/replace"
"value": "the new
JsonValue"
|
TEST
required members are:
"op": "test"
"path": "/path/to/test"
"value": "
JsonValue to test"
|
| Modifier and Type | Method and Description |
|---|---|
static JsonPatch.Operation |
fromOperationName(String operationName)
Returns the
JsonPatch.Operation for the given operationName. |
String |
operationName() |
static JsonPatch.Operation |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static JsonPatch.Operation[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final JsonPatch.Operation ADD
required members are:
JsonValueToAdd"
if the "path/to" does not exist, this operation will result in an error.
if the "path/to/add" already exists, the value will be replaced
for JsonArrays the new value will be inserted at the specified index
and the element(s) at/after are shifted to the right. the '-' character is used to append the value
at the and of the JsonArray.
public static final JsonPatch.Operation REMOVE
required members are:
if the "path/to/remove" does not exist, the operation will fail.
for JsonArrays the values after the removed value are shifted to the left
public static final JsonPatch.Operation REPLACE
public static final JsonPatch.Operation MOVE
required members are:
the operation will fail it the "path/to/move/from" does not exist
NOTICE: a location can not be moved into one of it's children. (from /a/b/c to /a/b/c/d)
this operation is identical to REMOVE from "from" and ADD to the "path"
public static final JsonPatch.Operation COPY
required members are:
the operation will result in an error if the "from" location does not exist
this operation is identical to ADD with the "from" value
public static final JsonPatch.Operation TEST
required members are:
JsonValue to test"this operation fails, if the value is NOT equal with the /path/to/test
ordering of the elements in a JsonObject is NOT significant however
the position of an element in a JsonArray is significant for equality.
public static JsonPatch.Operation[] values()
for (JsonPatch.Operation c : JsonPatch.Operation.values()) System.out.println(c);
public static JsonPatch.Operation valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic String operationName()
public static JsonPatch.Operation fromOperationName(String operationName)
JsonPatch.Operation for the given operationName. If no JsonPatch.Operation
is present, a JsonException will be thrown.operationName - operationName to convert to the enum constant.Operation-constant for given operationNameJsonException - if no JsonPatch.Operation has been found for the given operationNameCopyright © 2010 - 2020 Adobe. All Rights Reserved