Package io.permazen.core
Enum Class DeleteAction
- All Implemented Interfaces:
Serializable
,Comparable<DeleteAction>
,Constable
Describes what action to take when an object is deleted and a reference to that object from some other object still exists.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionAlso delete the object containing the reference.Throw aReferencedObjectException
, thereby preventing the delete operation from happening.Do nothing, thereby creating a dangling reference.Set the reference to null.Remove the corresponding list element, set element, or map entry. -
Method Summary
Modifier and TypeMethodDescriptionstatic DeleteAction
Returns the enum constant of this class with the specified name.static DeleteAction[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
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
Throw aReferencedObjectException
, 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
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
Remove the corresponding list element, set element, or map entry.This setting is only valid for complex sub-fields.
-
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
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
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 nameNullPointerException
- if the argument is null
-