Class SetAttributeConverter<T extends Collection<?>>

java.lang.Object
software.amazon.awssdk.enhanced.dynamodb.internal.converter.attribute.SetAttributeConverter<T>
All Implemented Interfaces:
AttributeConverter<T>

@ThreadSafe @Immutable public class SetAttributeConverter<T extends Collection<?>> extends Object implements AttributeConverter<T>
A converter between a specific Collection type and EnhancedAttributeValue.

This stores values in DynamoDB as a list of attribute values. This uses a configured AttributeConverter to convert the collection contents to an attribute value.

This supports reading a list of attribute values. This uses a configured AttributeConverter to convert the collection contents.

A builder is exposed to allow defining how the collection and element types are created and converted: AttributeConverter<List<Integer>> listConverter = CollectionAttributeConverter.builder(EnhancedType.listOf(Integer.class)) .collectionConstructor(ArrayList::new) .elementConverter(IntegerAttributeConverter.create()) .build()

For frequently-used types, static methods are exposed to reduce the amount of boilerplate involved in creation: AttributeConverter<List<Integer>> listConverter = CollectionAttributeConverter.listConverter(IntegerAttributeConverter.create());

AttributeConverter<Collection<Integer>> collectionConverer = CollectionAttributeConverter.collectionConverter(IntegerAttributeConverter.create());

AttributeConverter<Set<Integer>> setConverter = CollectionAttributeConverter.setConverter(IntegerAttributeConverter.create());

AttributeConverter<SortedSet<Integer>> sortedSetConverter = CollectionAttributeConverter.sortedSetConverter(IntegerAttributeConverter.create());

See Also: