Enum MutationDetection

java.lang.Object
java.lang.Enum<MutationDetection>
io.ebean.annotation.MutationDetection
All Implemented Interfaces:
Serializable, Comparable<MutationDetection>

public enum MutationDetection extends Enum<MutationDetection>
Mutation detection mode used on @DbJson properties.

The @DbJson properties are often plain beans and we use Jackson to store them in json form. These are the options for detecting if a bean as been mutated typically by comparing the json content (SOURCE mode) or comparing a hash/checksum of the json content (HASH mode).

  • Enum Constant Details

    • DEFAULT

      public static final MutationDetection DEFAULT
      Defaults to using HASH mode for plain Jackson beans. Collection types (List, Set, Map) use ModifyAware wrapper types to detect when the collection has been mutated but may not be aware of mutations of the elements.
    • NONE

      public static final MutationDetection NONE
      No dirty detection. The property is only included in an update when the property itself has been set. There is no attempt to detect if the bean has been mutated.
    • HASH

      public static final MutationDetection HASH
      Dirty detection using a hash checksum function on json content.

      A CRC32 checksum value of the json content is computed and held. For updates the checksum is compared and when it is different the property is deemed dirty and included in an update.

      Unlike SOURCE mode this does not support generating an 'oldValue' for change logs and persist listeners.

    • SOURCE

      public static final MutationDetection SOURCE
      Dirty detection using the original json content.

      The json content is kept for this property and dirty detection is performed by comparing the json content. As such this approach uses more memory than HASH mode.

      This mode supports 'oldValue' for change logs and persist listeners. The 'oldValue' of a mutated json bean can be rebuilt using the original json content. This 'oldValue' is then available for change logs and persist listeners.

  • Method Details

    • values

      public static MutationDetection[] 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

      public static MutationDetection 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