Enum Class DeleteAction

java.lang.Object
java.lang.Enum<DeleteAction>
io.permazen.core.DeleteAction
All Implemented Interfaces:
Serializable, Comparable<DeleteAction>, Constable

public enum DeleteAction extends Enum<DeleteAction>
Describes what action to take when an object is deleted and a reference to that object from some other object still exists.
See Also:
  • Enum Constant Details

    • IGNORE

      public static final DeleteAction IGNORE
      Do nothing, thereby creating a dangling reference.

      The reference will still exist, but subsequent attempts to access any field in the deleted object will result in a DeletedObjectException.

    • EXCEPTION

      public static final DeleteAction EXCEPTION
      Throw a ReferencedObjectException, thereby preventing the delete operation from happening.

      This is the default if not specified.

      Note: deleting an object that is only referred to by itself will not cause any exception to be thrown.

    • NULLIFY

      public static final DeleteAction NULLIFY
      Set the reference to null.

      When the reference field is a sub-field of a complex field, what that means depends on the type of collection:

      • If the reference field is a set element field, the reference will be removed from the set and null will be added to the set if not already present.
      • If the reference field is a list element field, the corresponding list entry will be set to null. Note this can happen to multiple entries in the same list.
      • If the reference field is a map key, the entry will be removed from the, map and an entry with null key and the original entry's same value will be inserted into the map, replacing any previous null key entry.
      • If the reference field is a map value, the map entry remains but its value will be set to null. Note this can happen to multiple entries in the same map.

      To always just remove the entry for complex sub-fields, use REMOVE instead.

    • REMOVE

      public static final DeleteAction REMOVE
      Remove the corresponding list element, set element, or map entry.

      This setting is only valid for complex sub-fields.

    • DELETE

      public static final DeleteAction DELETE
      Also delete the object containing the reference.

      This action will be repeated recursively, if necessary. Any reference loops are properly handled.

  • Method Details

    • values

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