Package io.fabric8.zjsonpatch
Enum DiffFlags
- java.lang.Object
-
- java.lang.Enum<DiffFlags>
-
- io.fabric8.zjsonpatch.DiffFlags
-
- All Implemented Interfaces:
Serializable,Comparable<DiffFlags>
public enum DiffFlags extends Enum<DiffFlags>
This class is ported from FlipKart zjsonpatch repository
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ADD_EXPLICIT_REMOVE_ADD_ON_REPLACEThis flag normalizes aOperation.REPLACEoperation into its respectiveOperation.REMOVEandOperation.ADDoperations.ADD_ORIGINAL_VALUE_ON_REPLACEThis flag adds a fromValue field to allOperation.REPLACEoperations.EMIT_TEST_OPERATIONSThis flag instructs the diff generator to emitOperation.TESToperations that validate the state of the source document before each mutation.OMIT_COPY_OPERATIONThis flag omits allOperation.COPYoperations, leaving onlyOperation.ADD,Operation.REMOVE,Operation.REPLACEandOperation.MOVEoperations.OMIT_MOVE_OPERATIONThis flag omits allOperation.MOVEoperations, leaving onlyOperation.ADD,Operation.REMOVE,Operation.REPLACEandOperation.COPYoperations.OMIT_VALUE_ON_REMOVEThis flag omits the value field on remove operations.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static EnumSet<DiffFlags>defaults()static EnumSet<DiffFlags>dontNormalizeOpIntoMoveAndCopy()static DiffFlagsvalueOf(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.
-
-
-
Enum Constant Detail
-
OMIT_VALUE_ON_REMOVE
public static final DiffFlags OMIT_VALUE_ON_REMOVE
This flag omits the value field on remove operations. This is a default flag.
-
OMIT_MOVE_OPERATION
public static final DiffFlags OMIT_MOVE_OPERATION
This flag omits allOperation.MOVEoperations, leaving onlyOperation.ADD,Operation.REMOVE,Operation.REPLACEandOperation.COPYoperations. In other words, without this flag,Operation.ADDandOperation.REMOVEoperations are not normalized intoOperation.MOVEoperations.
-
OMIT_COPY_OPERATION
public static final DiffFlags OMIT_COPY_OPERATION
This flag omits allOperation.COPYoperations, leaving onlyOperation.ADD,Operation.REMOVE,Operation.REPLACEandOperation.MOVEoperations. In other words, without this flag,Operation.ADDoperations are not normalized intoOperation.COPYoperations.
-
ADD_ORIGINAL_VALUE_ON_REPLACE
public static final DiffFlags ADD_ORIGINAL_VALUE_ON_REPLACE
This flag adds a fromValue field to allOperation.REPLACEoperations. fromValue represents the the value replaced by aOperation.REPLACEoperation, 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.- Since:
- 0.4.1
-
ADD_EXPLICIT_REMOVE_ADD_ON_REPLACE
public static final DiffFlags ADD_EXPLICIT_REMOVE_ADD_ON_REPLACE
This flag normalizes aOperation.REPLACEoperation into its respectiveOperation.REMOVEandOperation.ADDoperations. 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_REPLACEhas 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.
- Since:
- 0.4.11
-
EMIT_TEST_OPERATIONS
public static final DiffFlags EMIT_TEST_OPERATIONS
This flag instructs the diff generator to emitOperation.TESToperations 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.- Since:
- 0.4.8
-
-
Method Detail
-
values
public static DiffFlags[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (DiffFlags c : DiffFlags.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static DiffFlags valueOf(String name)
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
-
-