Enum UpdateBehavior

  • All Implemented Interfaces:
    Serializable, Comparable<UpdateBehavior>

    @ThreadSafe
    public enum UpdateBehavior
    extends Enum<UpdateBehavior>
    Update behaviors that can be applied to individual attributes. This behavior will only apply to 'update' operations such as UpdateItem, and not 'put' operations such as PutItem.

    If an update behavior is not specified for an attribute, the default behavior of WRITE_ALWAYS will be applied.

    • Enum Constant Detail

      • WRITE_ALWAYS

        public static final UpdateBehavior WRITE_ALWAYS
        Always overwrite with the new value if one is provided, or remove any existing value if a null value is provided and 'ignoreNulls' is set to false.

        This is the default behavior applied to all attributes unless otherwise specified.

      • WRITE_IF_NOT_EXISTS

        public static final UpdateBehavior WRITE_IF_NOT_EXISTS
        Write the new value if there is no existing value in the persisted record or a new record is being written, otherwise leave the existing value.

        IMPORTANT: If a null value is provided and 'ignoreNulls' is set to false, the attribute will always be removed from the persisted record as DynamoDb does not support conditional removal with this method.

    • Method Detail

      • values

        public static UpdateBehavior[] 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 (UpdateBehavior c : UpdateBehavior.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

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