Serializable, Comparable<DiffFlags>public enum DiffFlags extends Enum<DiffFlags>
| Enum Constant | Description |
|---|---|
ADD_EXPLICIT_REMOVE_ADD_ON_REPLACE |
This flag normalizes a
Operation.REPLACE operation into its respective
Operation.REMOVE and Operation.ADD operations. |
ADD_ORIGINAL_VALUE_ON_REPLACE |
This flag adds a fromValue field to all
Operation.REPLACE operations. |
EMIT_TEST_OPERATIONS |
This flag instructs the diff generator to emit
Operation.TEST operations
that validate the state of the source document before each mutation. |
OMIT_COPY_OPERATION |
This flag omits all
Operation.COPY operations, leaving only
Operation.ADD, Operation.REMOVE, Operation.REPLACE
and Operation.MOVE operations. |
OMIT_MOVE_OPERATION |
This flag omits all
Operation.MOVE operations, leaving only
Operation.ADD, Operation.REMOVE, Operation.REPLACE
and Operation.COPY operations. |
OMIT_VALUE_ON_REMOVE |
This flag omits the value field on remove operations.
|
| Modifier and Type | Method | Description |
|---|---|---|
static EnumSet<DiffFlags> |
defaults() |
|
static EnumSet<DiffFlags> |
dontNormalizeOpIntoMoveAndCopy() |
|
static DiffFlags |
valueOf(String name) |
Returns the enum constant of this type with the specified name.
|
static DiffFlags[] |
values() |
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final DiffFlags OMIT_VALUE_ON_REMOVE
public static final DiffFlags OMIT_MOVE_OPERATION
Operation.MOVE operations, leaving only
Operation.ADD, Operation.REMOVE, Operation.REPLACE
and Operation.COPY operations. In other words, without this flag,
Operation.ADD and Operation.REMOVE operations are not normalized
into Operation.MOVE operations.public static final DiffFlags OMIT_COPY_OPERATION
Operation.COPY operations, leaving only
Operation.ADD, Operation.REMOVE, Operation.REPLACE
and Operation.MOVE operations. In other words, without this flag,
Operation.ADD operations are not normalized into Operation.COPY
operations.public static final DiffFlags ADD_ORIGINAL_VALUE_ON_REPLACE
Operation.REPLACE operations.
fromValue represents the the value replaced by a Operation.REPLACE
operation, in other words, the original value. This can be useful for debugging
output or custom processing of the diffs by downstream systems.
Please note that this is a non-standard extension to RFC 6902 and will not affect
how patches produced by this library are processed by this or other libraries.public static final DiffFlags ADD_EXPLICIT_REMOVE_ADD_ON_REPLACE
Operation.REPLACE operation into its respective
Operation.REMOVE and Operation.ADD operations. Although it adds
a redundant step, this can be useful for auditing systems in which immutability
is a requirement.
For the flag to work, ADD_ORIGINAL_VALUE_ON_REPLACE has to be
enabled as the new instructions in the patch need to grab the old fromValue
"op": "replace", "fromValue": "F1", "value": "F2"
The above instruction will be split into
"op":"remove", "value":"F1" and "op":"add", "value":"F2" respectively.
Please note that this is a non-standard extension to RFC 6902 and will not affect how patches produced by this library are processed by this or other libraries.
public static final DiffFlags EMIT_TEST_OPERATIONS
Operation.TEST operations
that validate the state of the source document before each mutation. This can be
useful if you want to ensure data integrity prior to applying the patch.
The resulting patches are standard per RFC 6902 and should be processed correctly
by any compliant library; due to the associated space and performance costs,
however, this isn't default behavior.public static DiffFlags[] values()
for (DiffFlags c : DiffFlags.values()) System.out.println(c);
public static DiffFlags 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 nullCopyright © 2022. All rights reserved.