Class Table

    • Method Detail

      • getTableName

        public String getTableName()
      • getDescription

        public TableDescription getDescription()
        Returns the table description; or null if the table description has not yet been described via describe(). No network call.
      • describe

        public TableDescription describe()
        Retrieves the table description from DynamoDB. Involves network calls. Meant to be called as infrequently as possible to avoid throttling exception from the server side.
        Returns:
        a non-null table description
        Throws:
        ResourceNotFoundException - if the table doesn't exist
      • getIndex

        public Index getIndex​(String indexName)
        Gets a reference to the specified index. No network call.
      • getItemOutcome

        public GetItemOutcome getItemOutcome​(KeyAttribute... primaryKeyComponents)
        Description copied from interface: GetItemApi
        Retrieves an item and the associated information by primary key when the primary key is a hash-only key. Incurs network access.
        Specified by:
        getItemOutcome in interface GetItemApi
        Returns:
        the (non-null) result of item retrieval.
      • getItemOutcome

        public GetItemOutcome getItemOutcome​(PrimaryKey primaryKey)
        Description copied from interface: GetItemApi
        Retrieves an item and the associated information by primary key. Incurs network access.
        Specified by:
        getItemOutcome in interface GetItemApi
        Returns:
        the (non-null) result of item retrieval.
      • getItemOutcome

        public GetItemOutcome getItemOutcome​(PrimaryKey primaryKey,
                                             String projectionExpression,
                                             Map<String,​String> nameMap)
        Description copied from interface: GetItemApi
        Retrieves an item and the associated information using projection expression. Incurs network access.
        Specified by:
        getItemOutcome in interface GetItemApi
        projectionExpression - projection expression, example: "a.b , c[0].e"
        nameMap - actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.
        Returns:
        the (non-null) result of item retrieval.
      • getItemOutcome

        public GetItemOutcome getItemOutcome​(GetItemSpec params)
        Description copied from interface: GetItemApi
        Retrieves an item and the associated information by specifying all the details. Incurs network access.
        Specified by:
        getItemOutcome in interface GetItemApi
        Returns:
        the (non-null) result of item retrieval.
      • updateItem

        public UpdateItemOutcome updateItem​(PrimaryKey primaryKey,
                                            String updateExpression,
                                            Map<String,​String> nameMap,
                                            Map<String,​Object> valueMap)
        Description copied from interface: UpdateItemApi
        Performs an update on an item in the table using the given update expression string.
        Specified by:
        updateItem in interface UpdateItemApi
        Parameters:
        primaryKey - primary key of the item to be updated
        updateExpression - the update expression that specifies the attributes to be updated.
        nameMap - the map containing the mapping between attribute names used in update expression and the actual name of the attributes
        valueMap - the map containing the mapping between the attribute value used in update expression and the actual value of the attribute
      • updateItem

        public UpdateItemOutcome updateItem​(PrimaryKey primaryKey,
                                            String updateExpression,
                                            String conditionExpression,
                                            Map<String,​String> nameMap,
                                            Map<String,​Object> valueMap)
        Description copied from interface: UpdateItemApi
        Updates an item with the specified primary key using the given update expression provided the condition expression evaluates to true.
        Specified by:
        updateItem in interface UpdateItemApi
        Parameters:
        primaryKey - primary key of the item to be updated
        updateExpression - the update expression that specifies the attributes to be updated.
        conditionExpression - the condition expression that specifies the condition that needs to be evaluated to true
        nameMap - the map containing the mapping between attribute names used in update and condition expression and the actual name of the attributes
        valueMap - the map containing the mapping between the attribute value used in update and condition expression and the actual value of the attribute
      • updateItem

        public UpdateItemOutcome updateItem​(UpdateItemSpec updateItemSpec)
        Description copied from interface: UpdateItemApi
        Performs an update on an item in the table by specifying all the details.
        Specified by:
        updateItem in interface UpdateItemApi
        Parameters:
        updateItemSpec - the update specification for the item to be updated.
      • query

        public ItemCollection<QueryOutcome> query​(KeyAttribute hashKey,
                                                  RangeKeyCondition rangeKeyCondition,
                                                  String filterExpression,
                                                  String projectionExpression,
                                                  Map<String,​String> nameMap,
                                                  Map<String,​Object> valueMap)
        Description copied from interface: QueryApi
        Retrieves items by the specified hash key, a range key condition, a filter expression and a projection expression.
        Specified by:
        query in interface QueryApi
        filterExpression - filter expression example: "(#a > :a) AND (#c > :c OR #e < :e)"
        projectionExpression - projection expression example: "a.b, c[0].e"
        nameMap - actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.
        valueMap - actual values for the value place holders can be null if there is no attribute-value placeholder.
      • query

        public ItemCollection<QueryOutcome> query​(KeyAttribute hashKey,
                                                  RangeKeyCondition rangeKeyCondition,
                                                  String filterExpression,
                                                  Map<String,​String> nameMap,
                                                  Map<String,​Object> valueMap)
        Description copied from interface: QueryApi
        Retrieves items by the specified hash key, a range key condition, and a filter expression string.
        Specified by:
        query in interface QueryApi
        filterExpression - filter expression example: "(#a > :a) AND (#c > :c OR #e < :e)"
        nameMap - actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.
        valueMap - actual values for the value place holders can be null if there is no attribute-value placeholder.
      • scan

        public ItemCollection<ScanOutcome> scan​(String filterExpression,
                                                Map<String,​String> nameMap,
                                                Map<String,​Object> valueMap)
        Description copied from interface: ScanApi
        Scans table using a Filter Expression.
        Specified by:
        scan in interface ScanApi
        Parameters:
        filterExpression - condition expression example: "(#a > :a) AND (#c > :c OR #e < :e)"
        nameMap - actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.
        valueMap - actual values for the value place holders can be null if there is no attribute-value placeholder.
      • scan

        public ItemCollection<ScanOutcome> scan​(String filterExpression,
                                                String projectionExpression,
                                                Map<String,​String> nameMap,
                                                Map<String,​Object> valueMap)
        Description copied from interface: ScanApi
        Scans table using a Filter Expression and a Projection Expression.
        Specified by:
        scan in interface ScanApi
        Parameters:
        filterExpression - condition expression example: "(#a > :a) AND (#c > :c OR #e < :e)"
        projectionExpression - projection expression example: "a.b , c[0].e"
        nameMap - actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.
        valueMap - actual values for the value place holders can be null if there is no attribute-value placeholder.
      • updateTable

        public TableDescription updateTable​(UpdateTableSpec spec)
        Updates the provisioned throughput for this table. Setting the throughput for a table helps you manage performance and is part of the provisioned throughput feature of DynamoDB.

        The provisioned throughput values can be upgraded or downgraded based on the maximums and minimums listed in the Limits section in the Amazon DynamoDB Developer Guide.

        This table must be in the ACTIVE state for this operation to succeed. UpdateTable is an asynchronous operation; while executing the operation, the table is in the UPDATING state. While the table is in the UPDATING state, the table still has the provisioned throughput from before the call. The new provisioned throughput setting is in effect only when the table returns to the ACTIVE state after the UpdateTable operation.

        You can create, update or delete indexes using UpdateTable.

        Parameters:
        spec - used to specify all the detailed parameters
        Returns:
        the updated table description returned from DynamoDB.
      • createGSI

        public Index createGSI​(CreateGlobalSecondaryIndexAction create,
                               AttributeDefinition hashKeyDefinition)
        Creates a global secondary index (GSI) with only a hash key on this table. Involves network calls. This table must be in the ACTIVE state for this operation to succeed. Creating a global secondary index is an asynchronous operation; while executing the operation, the index is in the CREATING state. Once created, the index will be in ACTIVE state.
        Parameters:
        create - used to specify the details of the index creation
        hashKeyDefinition - used to specify the attribute for describing the key schema for the hash key of the GSI to be created for this table.
        Returns:
        the index being created
      • createGSI

        public Index createGSI​(CreateGlobalSecondaryIndexAction create,
                               AttributeDefinition hashKeyDefinition,
                               AttributeDefinition rangeKeyDefinition)
        Creates a global secondary index (GSI) with both a hash key and a range key on this table. Involves network calls. This table must be in the ACTIVE state for this operation to succeed. Creating a global secondary index is an asynchronous operation; while executing the operation, the index is in the CREATING state. Once created, the index will be in ACTIVE state.
        Parameters:
        create - used to specify the details of the index creation
        hashKeyDefinition - used to specify the attribute for describing the key schema for the hash key of the GSI to be created for this table.
        rangeKeyDefinition - used to specify the attribute for describing the key schema for the range key of the GSI to be created for this table.
        Returns:
        the index being created
      • updateTable

        public TableDescription updateTable​(ProvisionedThroughput provisionedThroughput)
        Updates the provisioned throughput for this table. Setting the throughput for a table helps you manage performance and is part of the provisioned throughput feature of DynamoDB.

        The provisioned throughput values can be upgraded or downgraded based on the maximums and minimums listed in the Limits section in the Amazon DynamoDB Developer Guide.

        This table must be in the ACTIVE state for this operation to succeed. UpdateTable is an asynchronous operation; while executing the operation, the table is in the UPDATING state. While the table is in the UPDATING state, the table still has the provisioned throughput from before the call. The new provisioned throughput setting is in effect only when the table returns to the ACTIVE state after the UpdateTable operation.

        You can create, update or delete indexes using UpdateTable.

        Parameters:
        provisionedThroughput - target provisioned throughput
        Returns:
        the updated table description returned from DynamoDB.
      • waitForDelete

        public void waitForDelete()
                           throws InterruptedException
        A convenient blocking call that can be used, typically during table deletion, to wait for the table to become deleted by polling the table every 5 seconds.
        Throws:
        InterruptedException
      • waitForActiveOrDelete

        public TableDescription waitForActiveOrDelete()
                                               throws InterruptedException
        A convenient blocking call that can be used to wait on a table until it has either become active or deleted (ie no longer exists) by polling the table every 5 seconds.
        Returns:
        the table description if the table has become active; or null if the table has been deleted.
        Throws:
        InterruptedException
      • waitForAllActiveOrDelete

        public TableDescription waitForAllActiveOrDelete()
                                                  throws InterruptedException
        A convenient blocking call that can be used to wait on a table and all it's indexes until both the table and it's indexes have either become active or deleted (ie no longer exists) by polling the table every 5 seconds.
        Returns:
        the table description if the table and all it's indexes have become active; or null if the table has been deleted.
        Throws:
        InterruptedException
      • delete

        public DeleteTableResult delete()
        Deletes the table from DynamoDB. Involves network calls.
      • getItem

        public Item getItem​(KeyAttribute... primaryKeyComponents)
        Description copied from interface: GetItemApi
        Retrieves an item by primary key. Incurs network access.
        Specified by:
        getItem in interface GetItemApi
        Returns:
        the retrieved item; or null if the item doesn't exist.
      • getItem

        public Item getItem​(PrimaryKey primaryKey)
        Description copied from interface: GetItemApi
        Retrieves an item by primary key; or null if the item doesn't exist. Incurs network access.
        Specified by:
        getItem in interface GetItemApi
        Returns:
        the retrieved item; or null if the item doesn't exist.
      • getItem

        public Item getItem​(PrimaryKey primaryKey,
                            String projectionExpression,
                            Map<String,​String> nameMap)
        Description copied from interface: GetItemApi
        Retrieves an item using projection expression. Incurs network access.
        Specified by:
        getItem in interface GetItemApi
        projectionExpression - projection expression, example: "a.b , c[0].e"
        nameMap - actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.
        Returns:
        the retrieved item; or null if the item doesn't exist.
      • getItem

        public Item getItem​(GetItemSpec spec)
        Description copied from interface: GetItemApi
        Retrieves an item by specifying all the details. Incurs network access.
        Specified by:
        getItem in interface GetItemApi
        Returns:
        the retrieved item; or null if the item doesn't exist.
      • getItemOutcome

        public GetItemOutcome getItemOutcome​(String hashKeyName,
                                             Object hashKeyValue)
        Description copied from interface: GetItemApi
        Retrieves an item and the associated information by primary key when the primary key is a hash-only key. Incurs network access.
        Specified by:
        getItemOutcome in interface GetItemApi
        Returns:
        the (non-null) result of item retrieval.
      • getItemOutcome

        public GetItemOutcome getItemOutcome​(String hashKeyName,
                                             Object hashKeyValue,
                                             String rangeKeyName,
                                             Object rangeKeyValue)
        Description copied from interface: GetItemApi
        Retrieves an item and the associated information by primary key when the primary key consists of both a hash-key and a range-key. Incurs network access.
        Specified by:
        getItemOutcome in interface GetItemApi
        Returns:
        the (non-null) result of item retrieval.
      • getItem

        public Item getItem​(String hashKeyName,
                            Object hashKeyValue)
        Description copied from interface: GetItemApi
        Retrieves an item by primary key when the primary key is a hash-only key. Incurs network access.
        Specified by:
        getItem in interface GetItemApi
        Returns:
        the retrieved item; or null if the item doesn't exist.
      • getItem

        public Item getItem​(String hashKeyName,
                            Object hashKeyValue,
                            String rangeKeyName,
                            Object rangeKeyValue)
        Description copied from interface: GetItemApi
        Retrieves an item by primary key when the primary key consists of both a hash-key and a range-key. Incurs network access.
        Specified by:
        getItem in interface GetItemApi
        Returns:
        the retrieved item; or null if the item doesn't exist.
      • query

        public ItemCollection<QueryOutcome> query​(String hashKeyName,
                                                  Object hashKeyValue,
                                                  RangeKeyCondition rangeKeyCondition,
                                                  String filterExpression,
                                                  String projectionExpression,
                                                  Map<String,​String> nameMap,
                                                  Map<String,​Object> valueMap)
        Description copied from interface: QueryApi
        Retrieves items by the specified hash key, a range key condition, a filter expression and a projection expression.
        Specified by:
        query in interface QueryApi
        filterExpression - filter expression example: "(#a > :a) AND (#c > :c OR #e < :e)"
        projectionExpression - projection expression example: "a.b, c[0].e"
        nameMap - actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.
        valueMap - actual values for the value place holders can be null if there is no attribute-value placeholder.
      • getItemOutcome

        public GetItemOutcome getItemOutcome​(String hashKeyName,
                                             Object hashKeyValue,
                                             String projectionExpression,
                                             Map<String,​String> nameMap)
        Description copied from interface: GetItemApi
        Retrieves an item and the associated information via the specified hash key using projection expression. Incurs network access.
        Specified by:
        getItemOutcome in interface GetItemApi
        Returns:
        the (non-null) result of item retrieval.
      • getItemOutcome

        public GetItemOutcome getItemOutcome​(String hashKeyName,
                                             Object hashKeyValue,
                                             String rangeKeyName,
                                             Object rangeKeyValue,
                                             String projectionExpression,
                                             Map<String,​String> nameMap)
        Description copied from interface: GetItemApi
        Retrieves an item and the associated information via the specified hash key and range key using projection expression. Incurs network access.
        Specified by:
        getItemOutcome in interface GetItemApi
        Returns:
        the (non-null) result of item retrieval.
      • getItem

        public Item getItem​(String hashKeyName,
                            Object hashKeyValue,
                            String projectionExpression,
                            Map<String,​String> nameMap)
        Description copied from interface: GetItemApi
        Retrieves an item via the specified hash key using projection expression. Incurs network access.
        Specified by:
        getItem in interface GetItemApi
        Returns:
        the retrieved item; or null if the item doesn't exist.
      • getItem

        public Item getItem​(String hashKeyName,
                            Object hashKeyValue,
                            String rangeKeyName,
                            Object rangeKeyValue,
                            String projectionExpression,
                            Map<String,​String> nameMap)
        Description copied from interface: GetItemApi
        Retrieves an item via the specified hash key and range key using projection expression. Incurs network access.
        Specified by:
        getItem in interface GetItemApi
        Returns:
        the retrieved item; or null if the item doesn't exist.