Enum DiffFlags

    • 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.
      • 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 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 name
        NullPointerException - if the argument is null
      • dontNormalizeOpIntoMoveAndCopy

        public static EnumSet<DiffFlags> dontNormalizeOpIntoMoveAndCopy()