public class StaticTableSchema<T> extends Object implements TableSchema<T>
Modifier and Type | Class and Description |
---|---|
static class |
StaticTableSchema.Builder<T> |
static class |
StaticTableSchema.GenericBuilder |
Modifier and Type | Method and Description |
---|---|
static StaticTableSchema.GenericBuilder |
builder()
Returns a builder for the default implementation of this interface which is an immutable, declarative, type-safe
mapper.
|
AttributeValue |
getAttributeValue(T item,
String key)
Returns a single attribute value from the modelled object.
|
StaticTableMetadata |
getTableMetadata()
Returns the object that describes the structure of the table being modelled by the mapper.
|
Map<String,AttributeValue> |
itemToMap(T item,
boolean ignoreNulls)
Takes a modelled object and converts it into a raw map of
AttributeValue that the DynamoDb low-level
SDK can work with. |
Map<String,AttributeValue> |
itemToMap(T item,
Collection<String> attributes)
Takes a modelled object and extracts a specific set of attributes which are then returned as a map of
AttributeValue that the DynamoDb low-level SDK can work with. |
T |
mapToItem(Map<String,AttributeValue> attributeMap)
Takes a raw DynamoDb SDK representation of a record in a table and maps it to a Java object.
|
public static StaticTableSchema.GenericBuilder builder()
TableSchema
StaticTableSchema
for more information.builder
in interface TableSchema<T>
StaticTableSchema
.public StaticTableMetadata getTableMetadata()
TableSchema
getTableMetadata
in interface TableSchema<T>
TableMetadata
object that contains structural information about the table being modelled.public T mapToItem(Map<String,AttributeValue> attributeMap)
TableSchema
mapToItem
in interface TableSchema<T>
attributeMap
- A map of String to AttributeValue
that contains all the raw attributes to map.public Map<String,AttributeValue> itemToMap(T item, boolean ignoreNulls)
TableSchema
AttributeValue
that the DynamoDb low-level
SDK can work with.itemToMap
in interface TableSchema<T>
item
- The modelled Java object to convert into a map of attributes.ignoreNulls
- If set to true; any null values in the Java object will not be added to the output map.
If set to false; null values in the Java object will be added as AttributeValue
of
type 'nul' to the output map.AttributeValue
representing all the modelled attributes in the model object.public Map<String,AttributeValue> itemToMap(T item, Collection<String> attributes)
TableSchema
AttributeValue
that the DynamoDb low-level SDK can work with. This method is typically used to extract
just the key attributes of a modelled item and will not ignore nulls on the modelled object.itemToMap
in interface TableSchema<T>
item
- The modelled Java object to extract the map of attributes from.attributes
- A collection of attribute names to extract into the output map.AttributeValue
representing the requested modelled attributes in the model
object.public AttributeValue getAttributeValue(T item, String key)
TableSchema
getAttributeValue
in interface TableSchema<T>
item
- The modelled Java object to extract the attribute from.key
- The attribute name describing which attribute to extract.AttributeValue
representing the requested modelled attribute in the model object or
null if the attribute has not been set with a value in the modelled object.Copyright © 2019. All rights reserved.