Class EnhancedClientUtils
- java.lang.Object
-
- software.amazon.awssdk.enhanced.dynamodb.internal.EnhancedClientUtils
-
public final class EnhancedClientUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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
keyRef(String key)
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
valueRef(String value)
Creates a value token to be used with an ExpressionValues map.
-
-
-
Method Detail
-
cleanAttributeName
public static String cleanAttributeName(String key)
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
public static String keyRef(String key)
Creates a key token to be used with an ExpressionNames map.
-
valueRef
public static String valueRef(String value)
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
public static <T> Key createKeyFromItem(T item, TableSchema<T> tableSchema, String indexName)
-
createKeyFromMap
public static Key createKeyFromMap(Map<String,AttributeValue> itemMap, TableSchema<?> tableSchema, String indexName)
-
getItemsFromSupplier
public static <T> List<T> getItemsFromSupplier(List<Supplier<T>> itemSupplierList)
-
isNullAttributeValue
public static boolean isNullAttributeValue(AttributeValue attributeValue)
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.
-
-