Class EnhancedClientUtils
java.lang.Object
software.amazon.awssdk.enhanced.dynamodb.internal.EnhancedClientUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
cleanAttributeName
(String key) There is a divergence in what constitutes an acceptable attribute name versus a token used in expression names or values.static <T> Key
createKeyFromItem
(T item, TableSchema<T> tableSchema, String indexName) static Key
createKeyFromMap
(Map<String, AttributeValue> itemMap, TableSchema<?> tableSchema, String indexName) static <T> List
<T> getItemsFromSupplier
(List<Supplier<T>> itemSupplierList) static boolean
isNullAttributeValue
(AttributeValue attributeValue) A helper method to test if anAttributeValue
is a 'null' constant.static String
Creates a key token to be used with an ExpressionNames map.static <ResponseT,
ItemT>
Page<ItemT> readAndTransformPaginatedItems
(ResponseT response, TableSchema<ItemT> tableSchema, OperationContext operationContext, DynamoDbEnhancedClientExtension dynamoDbEnhancedClientExtension, Function<ResponseT, List<Map<String, AttributeValue>>> getItems, Function<ResponseT, Map<String, AttributeValue>> getLastEvaluatedKey, Function<ResponseT, Integer> count, Function<ResponseT, Integer> scannedCount, Function<ResponseT, ConsumedCapacity> consumedCapacity) static <T> T
readAndTransformSingleItem
(Map<String, AttributeValue> itemMap, TableSchema<T> tableSchema, OperationContext operationContext, DynamoDbEnhancedClientExtension dynamoDbEnhancedClientExtension) static String
Creates a value token to be used with an ExpressionValues map.
-
Method Details
-
cleanAttributeName
There is a divergence in what constitutes an acceptable attribute name versus a token used in expression names or values. Since the mapper translates one to the other, it is necessary to scrub out all these 'illegal' characters before adding them to expression values or expression names.- Parameters:
key
- A key that may contain non alpha-numeric characters acceptable to a DynamoDb attribute name.- Returns:
- A key that has all these characters scrubbed and overwritten with an underscore.
-
keyRef
Creates a key token to be used with an ExpressionNames map. -
valueRef
Creates a value token to be used with an ExpressionValues map. -
readAndTransformSingleItem
public static <T> T readAndTransformSingleItem(Map<String, AttributeValue> itemMap, TableSchema<T> tableSchema, OperationContext operationContext, DynamoDbEnhancedClientExtension dynamoDbEnhancedClientExtension) -
readAndTransformPaginatedItems
public static <ResponseT,ItemT> Page<ItemT> readAndTransformPaginatedItems(ResponseT response, TableSchema<ItemT> tableSchema, OperationContext operationContext, DynamoDbEnhancedClientExtension dynamoDbEnhancedClientExtension, Function<ResponseT, List<Map<String, AttributeValue>>> getItems, Function<ResponseT, Map<String, AttributeValue>> getLastEvaluatedKey, Function<ResponseT, Integer> count, Function<ResponseT, Integer> scannedCount, Function<ResponseT, ConsumedCapacity> consumedCapacity) -
createKeyFromItem
-
createKeyFromMap
public static Key createKeyFromMap(Map<String, AttributeValue> itemMap, TableSchema<?> tableSchema, String indexName) -
getItemsFromSupplier
-
isNullAttributeValue
A helper method to test if anAttributeValue
is a 'null' constant. This will not test if the AttributeValue object is null itself, and in fact will throw a NullPointerException if you pass in null.- Parameters:
attributeValue
- AnAttributeValue
to test for null.- Returns:
- true if the supplied AttributeValue represents a null value, or false if it does not.
-