Class AttributeValueConverter

java.lang.Object
dev.hogwai.dynamodb.simplified.internal.AttributeValueConverter

public final class AttributeValueConverter extends Object
Converts Java objects to DynamoDB AttributeValue.

Supports: null, String, Number, Boolean, byte[], List, Set (String/Number), and Map. Key-only operations (partition/sort keys) restrict to String, Number, and Binary.

  • Method Details

    • toAttributeValue

      public static @NonNull software.amazon.awssdk.services.dynamodb.model.AttributeValue toAttributeValue(@Nullable Object value)
      Converts any supported Java type to an AttributeValue.
      Parameters:
      value - the value to convert (may be null)
      Returns:
      the corresponding DynamoDB AttributeValue
    • toKeyAttributeValue

      public static @NonNull software.amazon.awssdk.services.dynamodb.model.AttributeValue toKeyAttributeValue(@Nullable Object value)
      Converts a partition key or sort key value to an AttributeValue. DynamoDB keys allow only String, Number, and Binary.
      Parameters:
      value - the key value to convert
      Returns:
      the corresponding DynamoDB AttributeValue
      Throws:
      IllegalArgumentException - if the value is null or an unsupported type