Enum IgnoreNullsMode

java.lang.Object
java.lang.Enum<IgnoreNullsMode>
software.amazon.awssdk.enhanced.dynamodb.model.IgnoreNullsMode
All Implemented Interfaces:
Serializable, Comparable<IgnoreNullsMode>

@SdkPublicApi public enum IgnoreNullsMode extends Enum<IgnoreNullsMode>
Determines how null-valued attributes in a Java object are handled during an update operation. This replaces the deprecated 'ignoreNulls' boolean parameter.

ignoreNulls(false) is equivalent to DEFAULT and ignoreNulls(true) is equivalent to MAPS_ONLY.

  • Enum Constant Details

    • SCALAR_ONLY

      public static final IgnoreNullsMode SCALAR_ONLY
      Ignores all null-valued properties and updates only the non-null scalar attributes at any nesting level. The SDK constructs update expressions that target individual nested attributes, allowing partial updates of nested beans or maps without overwriting sibling attributes.

      The target bean or map must already exist in DynamoDB. If it does not, DynamoDB returns a validation exception because the document path does not exist. Use MAPS_ONLY first to create the nested structure, then use SCALAR_ONLY for subsequent partial updates.

    • MAPS_ONLY

      public static final IgnoreNullsMode MAPS_ONLY
      Ignores null-valued top-level properties and replaces or adds entire beans and maps as whole values. Null-valued scalar attributes within a provided bean or map are retained (saved as null in DynamoDB).

      Use this mode to add a new nested bean or map that does not yet exist in DynamoDB, or to fully replace an existing one. This is equivalent to the deprecated ignoreNulls(true).

    • DEFAULT

      public static final IgnoreNullsMode DEFAULT
      Does not ignore any null values. Null-valued attributes in the Java object generate REMOVE actions in the update expression, deleting those attributes from the item in DynamoDB.

      This is the default mode and is equivalent to the deprecated ignoreNulls(false). When using this mode, you should typically retrieve the item first to avoid unintentionally removing attributes.

  • Method Details

    • values

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