Enum Class DiffFlags

java.lang.Object
java.lang.Enum<DiffFlags>
com.flipkart.zjsonpatch.DiffFlags
All Implemented Interfaces:
Serializable, Comparable<DiffFlags>, java.lang.constant.Constable

public enum DiffFlags extends Enum<DiffFlags>
  • Enum Constant Details

    • 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 all 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.
    • OMIT_COPY_OPERATION

      public static final DiffFlags OMIT_COPY_OPERATION
      This flag omits all 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.
    • ADD_ORIGINAL_VALUE_ON_REPLACE

      public static final DiffFlags ADD_ORIGINAL_VALUE_ON_REPLACE
      This flag adds a fromValue field to all 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.
      Since:
      0.4.1
    • ADD_EXPLICIT_REMOVE_ADD_ON_REPLACE

      public static final DiffFlags ADD_EXPLICIT_REMOVE_ADD_ON_REPLACE
      This flag normalizes a 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.

      Since:
      0.4.11
    • EMIT_TEST_OPERATIONS

      public static final DiffFlags 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. 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 Details

    • values

      public static DiffFlags[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DiffFlags valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null
    • defaults

      public static EnumSet<DiffFlags> defaults()
    • dontNormalizeOpIntoMoveAndCopy

      public static EnumSet<DiffFlags> dontNormalizeOpIntoMoveAndCopy()