Class DefaultDynamoDbAsyncIndex<T>
- java.lang.Object
-
- software.amazon.awssdk.enhanced.dynamodb.internal.client.DefaultDynamoDbAsyncIndex<T>
-
- All Implemented Interfaces:
DynamoDbAsyncIndex<T>
public final class DefaultDynamoDbAsyncIndex<T> extends Object implements DynamoDbAsyncIndex<T>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DynamoDbAsyncClient
dynamoDbClient()
boolean
equals(Object o)
int
hashCode()
String
indexName()
Gets the physical secondary index name that operations performed by this object will be executed against.Key
keyFrom(T item)
Creates aKey
object from a modelled item.DynamoDbEnhancedClientExtension
mapperExtension()
Gets theDynamoDbEnhancedClientExtension
associated with this mapped resource.SdkPublisher<Page<T>>
query(Consumer<QueryEnhancedRequest.Builder> requestConsumer)
Executes a query against a secondary index using aQueryConditional
expression to retrieve a list of items matching the given conditions.SdkPublisher<Page<T>>
query(QueryConditional queryConditional)
Executes a query against the secondary index of the table using aQueryConditional
expression to retrieve a list of items matching the given conditions.SdkPublisher<Page<T>>
query(QueryEnhancedRequest request)
Executes a query against a secondary index using aQueryConditional
expression to retrieve a list of items matching the given conditions.SdkPublisher<Page<T>>
scan()
Scans the table against a secondary index and retrieves all items using default settings.SdkPublisher<Page<T>>
scan(Consumer<ScanEnhancedRequest.Builder> requestConsumer)
Scans the table against a secondary index and retrieves all items.SdkPublisher<Page<T>>
scan(ScanEnhancedRequest request)
Scans the table against a secondary index and retrieves all items.String
tableName()
Gets the physical table name that operations performed by this object will be executed against.TableSchema<T>
tableSchema()
Gets theTableSchema
object that this mapped table was built with.
-
-
-
Method Detail
-
query
public SdkPublisher<Page<T>> query(QueryEnhancedRequest request)
Description copied from interface:DynamoDbAsyncIndex
Executes a query against a secondary index using aQueryConditional
expression to retrieve a list of items matching the given conditions.The result is accessed through iterable pages (see
Page
) in an interactive way; each time a result page is retrieved, a query call is made to DynamoDb to get those entries. If no matches are found, the resulting iterator will contain an empty page. Results are sorted by sort key value in ascending order by default; this behavior can be overridden in theQueryEnhancedRequest
.The additional configuration parameters that the enhanced client supports are defined in the
QueryEnhancedRequest
.This operation calls the low-level DynamoDB API Query operation. Consult the Query documentation for further details and constraints.
Example:
QueryConditional queryConditional = QueryConditional.keyEqualTo(Key.builder().partitionValue("id-value").build()); SdkPublisher<Page<MyItem>> publisher = mappedIndex.query(QueryEnhancedRequest.builder() .queryConditional(queryConditional) .build());
- Specified by:
query
in interfaceDynamoDbAsyncIndex<T>
- Parameters:
request
- AQueryEnhancedRequest
defining the query conditions and how to handle the results.- Returns:
- a publisher
SdkPublisher
with paginated results (seePage
).
-
query
public SdkPublisher<Page<T>> query(Consumer<QueryEnhancedRequest.Builder> requestConsumer)
Description copied from interface:DynamoDbAsyncIndex
Executes a query against a secondary index using aQueryConditional
expression to retrieve a list of items matching the given conditions.The result is accessed through iterable pages (see
Page
) in an interactive way; each time a result page is retrieved, a query call is made to DynamoDb to get those entries. If no matches are found, the resulting iterator will contain an empty page. Results are sorted by sort key value in ascending order by default; this behavior can be overridden in theQueryEnhancedRequest
.The additional configuration parameters that the enhanced client supports are defined in the
QueryEnhancedRequest
.This operation calls the low-level DynamoDB API Query operation. Consult the Query documentation for further details and constraints.
Note: This is a convenience method that creates an instance of the request builder avoiding the need to create one manually via
QueryEnhancedRequest.builder()
.Example:
SdkPublisher<Page<MyItem>> publisher = mappedIndex.query(r -> r.queryConditional(QueryConditional.keyEqualTo(k -> k.partitionValue("id-value"))));
- Specified by:
query
in interfaceDynamoDbAsyncIndex<T>
- Parameters:
requestConsumer
- AConsumer
ofQueryEnhancedRequest
defining the query conditions and how to handle the results.- Returns:
- a publisher
SdkPublisher
with paginated results (seePage
).
-
query
public SdkPublisher<Page<T>> query(QueryConditional queryConditional)
Description copied from interface:DynamoDbAsyncIndex
Executes a query against the secondary index of the table using aQueryConditional
expression to retrieve a list of items matching the given conditions.The result is accessed through iterable pages (see
Page
) in an interactive way; each time a result page is retrieved, a query call is made to DynamoDb to get those entries. If no matches are found, the resulting iterator will contain an empty page. Results are sorted by sort key value in ascending order.This operation calls the low-level DynamoDB API Query operation. Consult the Query documentation for further details and constraints.
Example:
SdkPublisher<Page<MyItem>> results = mappedIndex.query(QueryConditional.keyEqualTo(Key.builder().partitionValue("id-value").build()));
- Specified by:
query
in interfaceDynamoDbAsyncIndex<T>
- Parameters:
queryConditional
- AQueryConditional
defining the matching criteria for records to be queried.- Returns:
- a publisher
SdkPublisher
with paginated results (seePage
).
-
scan
public SdkPublisher<Page<T>> scan(ScanEnhancedRequest request)
Description copied from interface:DynamoDbAsyncIndex
Scans the table against a secondary index and retrieves all items.The result is accessed through iterable pages (see
Page
) in an interactive way; each time a result page is retrieved, a scan call is made to DynamoDb to get those entries. If no matches are found, the resulting iterator will contain an empty page.The additional configuration parameters that the enhanced client supports are defined in the
ScanEnhancedRequest
.Example:
SdkPublisher<Page<MyItem>> publisher = mappedTable.scan(ScanEnhancedRequest.builder().consistentRead(true).build());
- Specified by:
scan
in interfaceDynamoDbAsyncIndex<T>
- Parameters:
request
- AScanEnhancedRequest
defining how to handle the results.- Returns:
- a publisher
SdkPublisher
with paginated results (seePage
).
-
scan
public SdkPublisher<Page<T>> scan(Consumer<ScanEnhancedRequest.Builder> requestConsumer)
Description copied from interface:DynamoDbAsyncIndex
Scans the table against a secondary index and retrieves all items.The result is accessed through iterable pages (see
Page
) in an interactive way; each time a result page is retrieved, a scan call is made to DynamoDb to get those entries. If no matches are found, the resulting iterator will contain an empty page.The additional configuration parameters that the enhanced client supports are defined in the
ScanEnhancedRequest
.Note: This is a convenience method that creates an instance of the request builder avoiding the need to create one manually via
ScanEnhancedRequest.builder()
.Example:
SdkPublisher<Page<MyItem>> publisher = mappedTable.scan(r -> r.limit(5));
- Specified by:
scan
in interfaceDynamoDbAsyncIndex<T>
- Parameters:
requestConsumer
- AConsumer
ofScanEnhancedRequest
defining the query conditions and how to handle the results.- Returns:
- a publisher
SdkPublisher
with paginated results (seePage
).
-
scan
public SdkPublisher<Page<T>> scan()
Description copied from interface:DynamoDbAsyncIndex
Scans the table against a secondary index and retrieves all items using default settings.The result is accessed through iterable pages (see
Page
) in an interactive way; each time a result page is retrieved, a scan call is made to DynamoDb to get those entries. If no matches are found, the resulting iterator will contain an empty page.Example:
SdkPublisher<Page<MyItem>> publisher = mappedTable.scan();
- Specified by:
scan
in interfaceDynamoDbAsyncIndex<T>
- Returns:
- a publisher
SdkPublisher
with paginated results (seePage
).
-
mapperExtension
public DynamoDbEnhancedClientExtension mapperExtension()
Description copied from interface:DynamoDbAsyncIndex
Gets theDynamoDbEnhancedClientExtension
associated with this mapped resource.- Specified by:
mapperExtension
in interfaceDynamoDbAsyncIndex<T>
- Returns:
- The
DynamoDbEnhancedClientExtension
associated with this mapped resource.
-
tableSchema
public TableSchema<T> tableSchema()
Description copied from interface:DynamoDbAsyncIndex
Gets theTableSchema
object that this mapped table was built with.- Specified by:
tableSchema
in interfaceDynamoDbAsyncIndex<T>
- Returns:
- The
TableSchema
object for this mapped table.
-
dynamoDbClient
public DynamoDbAsyncClient dynamoDbClient()
-
tableName
public String tableName()
Description copied from interface:DynamoDbAsyncIndex
Gets the physical table name that operations performed by this object will be executed against.- Specified by:
tableName
in interfaceDynamoDbAsyncIndex<T>
- Returns:
- The physical table name.
-
indexName
public String indexName()
Description copied from interface:DynamoDbAsyncIndex
Gets the physical secondary index name that operations performed by this object will be executed against.- Specified by:
indexName
in interfaceDynamoDbAsyncIndex<T>
- Returns:
- The physical secondary index name.
-
keyFrom
public Key keyFrom(T item)
Description copied from interface:DynamoDbAsyncIndex
Creates aKey
object from a modelled item. This key can be used in query conditionals and get operations to locate a specific record.- Specified by:
keyFrom
in interfaceDynamoDbAsyncIndex<T>
- Parameters:
item
- The item to extract the key fields from.- Returns:
- A key that has been initialized with the index values extracted from the modelled object.
-
-