Package org.leo.aws.ddb.repositories
Interface DataMapper<T>
-
- All Known Implementing Classes:
AbstractDataMapper
interface DataMapper<T>
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.LoggerLOGGER
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidapplyTTLLogic(T item, Map<String,software.amazon.awssdk.services.dynamodb.model.AttributeValue> attributeValueMap)default PrimaryKeycreatePKFromItem(T item)Generate the primary key (hash key/range key combination) from the entity passed.default Function<software.amazon.awssdk.services.dynamodb.model.AttributeValue.Builder,software.amazon.awssdk.services.dynamodb.model.AttributeValue.Builder>getAttributeBuilderFunctionForKeys(Object keyValue)default Stream<Tuple4<String,Object,Field,DbAttribute>>getMappedValues(T input)Class<T>getParameterType()default Map<KeyType,Tuple<String,Field>>getPKMapping()default Map<String,software.amazon.awssdk.services.dynamodb.model.AttributeValue>getPrimaryKey(PrimaryKey primaryKey)Returns Attribute name to value mapping for the primary key objectdefault Tuple<Field,DbAttribute>getVersionedAttribute()default TmapFromAttributeValueToEntity(Map<String,software.amazon.awssdk.services.dynamodb.model.AttributeValue> attributeValues)default Map<String,software.amazon.awssdk.services.dynamodb.model.AttributeValue>mapFromEntityToAttributeValue(T input)Method constructs Attribute name to value map that is required by the AWS DDB SDK to make updates.default StringtableName()
-
-
-
Method Detail
-
mapFromAttributeValueToEntity
default T mapFromAttributeValueToEntity(Map<String,software.amazon.awssdk.services.dynamodb.model.AttributeValue> attributeValues)
- Parameters:
attributeValues- Attribute values returned by the AWS DynamoDB SDK- Returns:
- The entity object representing the attribute value passed.
-
mapFromEntityToAttributeValue
default Map<String,software.amazon.awssdk.services.dynamodb.model.AttributeValue> mapFromEntityToAttributeValue(T input)
Method constructs Attribute name to value map that is required by the AWS DDB SDK to make updates.- Parameters:
input- Entity Object- Returns:
- Attribute name to value mapping.
-
getVersionedAttribute
default Tuple<Field,DbAttribute> getVersionedAttribute()
-
getPrimaryKey
default Map<String,software.amazon.awssdk.services.dynamodb.model.AttributeValue> getPrimaryKey(PrimaryKey primaryKey)
Returns Attribute name to value mapping for the primary key object- Parameters:
primaryKey- Primary Key representing a record.- Returns:
- Attribute name to value mapping
-
getAttributeBuilderFunctionForKeys
default Function<software.amazon.awssdk.services.dynamodb.model.AttributeValue.Builder,software.amazon.awssdk.services.dynamodb.model.AttributeValue.Builder> getAttributeBuilderFunctionForKeys(Object keyValue)
-
createPKFromItem
default PrimaryKey createPKFromItem(T item)
Generate the primary key (hash key/range key combination) from the entity passed.
-
applyTTLLogic
default void applyTTLLogic(T item, Map<String,software.amazon.awssdk.services.dynamodb.model.AttributeValue> attributeValueMap)
-
tableName
default String tableName()
- Returns:
- name of the DDB table name the entity class represents
-
getMappedValues
default Stream<Tuple4<String,Object,Field,DbAttribute>> getMappedValues(T input)
- Parameters:
input- Entity object- Returns:
- Field values along with the attribute name in the DDB table to which it is mapped to.
-
-