TableSchema (AWS SDK for Java

JavaScript is disabled on your browser. All MethodsStatic MethodsInstance MethodsAbstract MethodsDefault Methods Returns a single attribute value from the modelled object. boolean Takes a raw DynamoDb SDK representation of a record in a table and maps it to a Java object.

TableSchema (AWS SDK for Java - 2.25.34) Type Parameters: T - The type of model object that is being mapped to records in the DynamoDb table. All Known Implementing Classes: BeanTableSchema, DocumentTableSchema, ImmutableTableSchema, MetaTableSchema, StaticImmutableTableSchema, StaticTableSchema, WrappedTableSchema Interface for a mapper that is capable of mapping a modelled Java object into a map of AttributeValue that is understood by the DynamoDb low-level SDK and back again. This object is also expected to know about the structure of the table it is modelling, which is stored in a TableMetadata object.
  • Method Summary

    All MethodsStatic MethodsInstance MethodsAbstract MethodsDefault Methods

    Returns a complete list of attribute names that are mapped by this TableSchema

    Returns a single attribute value from the modelled object.

    Returns a builder for the StaticTableSchema implementation of this interface which allows all attributes, tags and table structure to be directly declared in the builder. Returns a builder for the StaticImmutableTableSchema implementation of this interface which allows all attributes, tags and table structure to be directly declared in the builder. Returns a builder for the StaticTableSchema implementation of this interface which allows all attributes, tags and table structure to be directly declared in the builder. Returns a builder for the StaticImmutableTableSchema implementation of this interface which allows all attributes, tags and table structure to be directly declared in the builder. Provides interfaces to interact with DynamoDB tables as EnhancedDocument where the complete Schema of the table is not required. Scans a bean class that has been annotated with DynamoDb bean annotations and then returns a BeanTableSchema implementation of this interface that can map records to and from items of that bean class. Scans a class that has been annotated with DynamoDb enhanced client annotations and then returns an appropriate TableSchema implementation that can map records to and from items of that class. Scans an immutable class that has been annotated with DynamoDb immutable annotations and then returns a ImmutableTableSchema implementation of this interface that can map records to and from items of that immutable class.

    boolean

    A boolean value that represents whether this TableSchema is abstract which means that it cannot be used to directly create records as it is lacking required structural elements to map to a table, such as a primary key, but can be referred to and embedded by other schemata. Takes a modelled object and converts it into a raw map of AttributeValue that the DynamoDb low-level SDK can work with. 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. Returns the EnhancedType that represents the 'Type' of the Java object this table schema object maps to and from.

    Takes a raw DynamoDb SDK representation of a record in a table and maps it to a Java object.

    Takes a raw DynamoDb SDK representation of a record in a table and maps it to a Java object.

    Returns the object that describes the structure of the table being modelled by the mapper.

  • Method Details

    • builder

      Returns a builder for the StaticTableSchema implementation of this interface which allows all attributes, tags and table structure to be directly declared in the builder. Type Parameters: T - The type of the item this TableSchema will map records to. Parameters: itemClass - The class of the item this TableSchema will map records to. Returns: A newly initialized StaticTableSchema.Builder.
    • builder

      Returns a builder for the StaticTableSchema implementation of this interface which allows all attributes, tags and table structure to be directly declared in the builder. Type Parameters: T - The type of the item this TableSchema will map records to. Parameters: itemType - The EnhancedType of the item this TableSchema will map records to. Returns: A newly initialized StaticTableSchema.Builder.
    • builder

      Returns a builder for the StaticImmutableTableSchema implementation of this interface which allows all attributes, tags and table structure to be directly declared in the builder. Type Parameters: T - The type of the immutable item this TableSchema will map records to. B - The type of the builder used by this TableSchema to construct immutable items with. Parameters: immutableItemClass - The class of the immutable item this TableSchema will map records to. immutableBuilderClass - The class that can be used to construct immutable items this TableSchema maps records to. Returns: A newly initialized StaticImmutableTableSchema.Builder
    • builder

      Returns a builder for the StaticImmutableTableSchema implementation of this interface which allows all attributes, tags and table structure to be directly declared in the builder. Type Parameters: T - The type of the immutable item this TableSchema will map records to. B - The type of the builder used by this TableSchema to construct immutable items with. Parameters: immutableItemType - The EnhancedType of the immutable item this TableSchema will map records to. immutableBuilderType - The EnhancedType of the class that can be used to construct immutable items this TableSchema maps records to. Returns: A newly initialized StaticImmutableTableSchema.Builder
    • fromBean

      Scans a bean class that has been annotated with DynamoDb bean annotations and then returns a BeanTableSchema implementation of this interface that can map records to and from items of that bean class.

      It's recommended to only create a BeanTableSchema once for a single bean class, usually at application start up, because it's a moderately expensive operation.

      Type Parameters: T - The type of the item this TableSchema will map records to. Parameters: beanClass - The bean class this TableSchema will map records to. Returns: An initialized BeanTableSchema.
    • documentSchemaBuilder

      Provides interfaces to interact with DynamoDB tables as EnhancedDocument where the complete Schema of the table is not required. Returns: A DocumentTableSchema.Builder for instantiating DocumentTableSchema.
    • fromImmutableClass

      Scans an immutable class that has been annotated with DynamoDb immutable annotations and then returns a ImmutableTableSchema implementation of this interface that can map records to and from items of that immutable class.

      It's recommended to only create an ImmutableTableSchema once for a single immutable class, usually at application start up, because it's a moderately expensive operation.

      Type Parameters: T - The type of the item this TableSchema will map records to. Parameters: immutableClass - The immutable class this TableSchema will map records to. Returns: An initialized ImmutableTableSchema.
    • fromClass

      Scans a class that has been annotated with DynamoDb enhanced client annotations and then returns an appropriate TableSchema implementation that can map records to and from items of that class. Currently supported top level annotations (see documentation on those classes for more information on how to use them): DynamoDbBean, DynamoDbImmutable.

      It's recommended to only invoke this operation once for a single class, usually at application start up, because it's a moderately expensive operation.

      If this table schema is not behaving as you expect, enable debug logging for software.amazon.awssdk.enhanced.dynamodb.beans.

      Type Parameters: T - The type of the item this TableSchema will map records to. Parameters: annotatedClass - A class that has been annotated with DynamoDb enhanced client annotations. Returns: An initialized TableSchema
    • mapToItem

      Takes a raw DynamoDb SDK representation of a record in a table and maps it to a Java object. A new object is created to fulfil this operation.

      If attributes are missing from the map, that will not cause an error, however if attributes are found in the map which the mapper does not know how to map, an exception will be thrown.

      If all attribute values in the attributeMap are null, null will be returned. Use mapToItem(Map, boolean) instead if you need to preserve empty object.

      API Implementors Note:

      mapToItem(Map, boolean) must be implemented if preserveEmptyObject behavior is desired.

      Parameters: attributeMap - A map of String to AttributeValue that contains all the raw attributes to map. Returns: A new instance of a Java object with all the attributes mapped onto it. Throws: IllegalArgumentException - if any attributes in the map could not be mapped onto the new model object. See Also:
    • mapToItem

      Takes a raw DynamoDb SDK representation of a record in a table and maps it to a Java object. A new object is created to fulfil this operation.

      If attributes are missing from the map, that will not cause an error, however if attributes are found in the map which the mapper does not know how to map, an exception will be thrown.

      In the scenario where all attribute values in the map are null, it will return null if preserveEmptyObject is true. If it's false, an empty object will be returned.

      Note that preserveEmptyObject only applies to the top level Java object, if it has nested "empty" objects, they will be mapped as null. You can use DynamoDbPreserveEmptyObject to configure this behavior for nested objects.

      API Implementors Note:

      This method must be implemented if preserveEmptyObject behavior is to be supported

      Parameters: attributeMap - A map of String to AttributeValue that contains all the raw attributes to map. preserveEmptyObject - whether to initialize this Java object as empty class if all fields are null Returns: A new instance of a Java object with all the attributes mapped onto it. Throws: IllegalArgumentException - if any attributes in the map could not be mapped onto the new model object. UnsupportedOperationException - if preserveEmptyObject is not supported in the implementation See Also:
    • itemToMap

      Takes a modelled object and converts it into a raw map of AttributeValue that the DynamoDb low-level SDK can work with. Parameters: 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. Returns: A map of String to AttributeValue representing all the modelled attributes in the model object.
    • itemToMap

      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. This method is typically used to extract just the key attributes of a modelled item and will not ignore nulls on the modelled object. Parameters: item - The modelled Java object to extract the map of attributes from. attributes - A collection of attribute names to extract into the output map. Returns: A map of String to AttributeValue representing the requested modelled attributes in the model object.
    • attributeValue

      Returns a single attribute value from the modelled object.

      Parameters: item - The modelled Java object to extract the attribute from. attributeName - The attribute name describing which attribute to extract. Returns: A single 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.
    • tableMetadata

      Returns the object that describes the structure of the table being modelled by the mapper. This includes information such as the table name, index keys and attribute tags.

      Returns: A TableMetadata object that contains structural information about the table being modelled.
    • itemType

      Returns the EnhancedType that represents the 'Type' of the Java object this table schema object maps to and from. Returns: The EnhancedType of the modelled item this TableSchema maps to.
    • attributeNames

      Returns a complete list of attribute names that are mapped by this TableSchema
    • isAbstract

      boolean isAbstract()

      A boolean value that represents whether this TableSchema is abstract which means that it cannot be used to directly create records as it is lacking required structural elements to map to a table, such as a primary key, but can be referred to and embedded by other schemata. Returns: true if it is abstract, and therefore cannot be used directly to create records but can be referred to by other schemata, and false if it is concrete and may be used to map records directly.
    • converterForAttribute

      Parameters: key - Attribute of the modelled item. Returns: AttributeConverter defined for the given attribute key.

ncG1vNJzZmirlKB7ornAs6anmaeoe6S7zGihmq6RZK6xtY6lmK2do6l8tLvFra6aqpVkrq6t2ailaJmnqMClt46epaGZnpiypXvDsqWapZ%2BZr3CgwJujnouTnbKurY2hq6ak

 Share!