Enum JsonPatch.Operation
- All Implemented Interfaces:
Serializable
,Comparable<JsonPatch.Operation>
,java.lang.constant.Constable
- Enclosing interface:
JsonPatch
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.
- Since:
- 1.1
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionrequired members are: "op": "add" "path": "path/to/add" "value": "JsonValue
ToAdd"required members are: "op": "copy" "from": "path/to/copy/from" "path": "path/to/add"required members are: "op": "move" "from": "path/to/move/from" "path": "path/to/move/to"required members are: "op": "remove" "path": "path/to/remove"required members are: "op": "replace" "path": "path/to/replace" "value": "the newJsonValue
"required members are: "op": "test" "path": "/path/to/test" "value": "JsonValue
to test" -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonPatch.Operation
fromOperationName
(String operationName) Returns theJsonPatch.Operation
for the givenoperationName
.static JsonPatch.Operation
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.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
ADD
required members are:
- "op": "add"
- "path": "path/to/add"
- "value": "
JsonValue
ToAdd"
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 replacedfor
JsonArray
s 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 theJsonArray
. -
REMOVE
required members are:
- "op": "remove"
- "path": "path/to/remove"
if the "path/to/remove" does not exist, the operation will fail.
for
JsonArray
s the values after the removed value are shifted to the left -
REPLACE
-
MOVE
required members are:
- "op": "move"
- "from": "path/to/move/from"
- "path": "path/to/move/to"
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" andADD
to the "path" -
COPY
required members are:
- "op": "copy"
- "from": "path/to/copy/from"
- "path": "path/to/add"
the operation will result in an error if the "from" location does not exist
this operation is identical to
ADD
with the "from" value -
TEST
required members are:
- "op": "test"
- "path": "/path/to/test"
- "value": "
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 aJsonArray
is significant for equality.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
operationName
- Returns:
- the JSON operation name
-
fromOperationName
Returns theJsonPatch.Operation
for the givenoperationName
. If noJsonPatch.Operation
is present, aJsonException
will be thrown.- Parameters:
operationName
-operationName
to convert to the enum constant.- Returns:
- the
Operation-constant
for givenoperationName
- Throws:
JsonException
- if noJsonPatch.Operation
has been found for the givenoperationName
-