public class DynamoDBMapper
extends java.lang.Object
To use, define a domain class that represents an item in a DynamoDB table and annotate it with the annotations found in the com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper package. In order to allow the mapper to correctly persist the data, each modeled property in the domain class should be accessible via getter and setter methods, and each property annotation should be either applied to the getter method or the class field. A minimal example using getter annotations:
@DynamoDBTable(tableName = "TestTable") public class TestClass { private Long key; private double rangeKey; private Long version; private Set<Integer> integerSetAttribute; @DynamoDBHashKey public Long getKey() { return key; } public void setKey(Long key) { this.key = key; } @DynamoDBRangeKey public double getRangeKey() { return rangeKey; } public void setRangeKey(double rangeKey) { this.rangeKey = rangeKey; } @DynamoDBAttribute(attributeName = "integerSetAttribute") public Set<Integer> getIntegerAttribute() { return integerSetAttribute; } public void setIntegerAttribute(Set<Integer> integerAttribute) { this.integerSetAttribute = integerAttribute; } @DynamoDBVersionAttribute public Long getVersion() { return version; } public void setVersion(Long version) { this.version = version; } }
Save instances of annotated classes to DynamoDB, retrieve them, and delete
them using the DynamoDBMapper
class, as in the following example.
DynamoDBMapper mapper = new DynamoDBMapper(dynamoDBClient); Long hashKey = 105L; double rangeKey = 1.0d; TestClass obj = mapper.load(TestClass.class, hashKey, rangeKey); obj.getIntegerAttribute().add(42); mapper.save(obj); mapper.delete(obj);
When using the save, load, and delete methods, DynamoDBMapper
will
throw DynamoDBMappingException
s to indicate that domain classes are
incorrectly annotated or otherwise incompatible with this class. Service
exceptions will always be propagated as AmazonClientException
, and
DynamoDB-specific subclasses such as ConditionalCheckFailedException
will be used when possible.
This class is thread-safe and can be shared between threads. It's also very lightweight, so it doesn't need to be.
Modifier and Type | Class and Description |
---|---|
static class |
DynamoDBMapper.Builder
Builder class for DynamoDBMapper
|
static class |
DynamoDBMapper.FailedBatch
The return type of batchWrite, batchDelete and batchSave.
|
Constructor and Description |
---|
DynamoDBMapper(AmazonDynamoDB dynamoDB)
Deprecated.
Please use DynamoDBMapper.builder()
.dynamoDBClient(dynamoDB)
.build();
|
DynamoDBMapper(AmazonDynamoDB ddb,
AWSCredentialsProvider s3CredentialProvider)
Deprecated.
Please use DynamoDBMapper.builder()
.dynamoDBClient(dynamoDB)
.awsCredentialsProviderForS3(creds)
.build();
|
DynamoDBMapper(AmazonDynamoDB dynamoDB,
DynamoDBMapperConfig config)
Deprecated.
Please use
DynamoDBMapper.builder()
.dynamoDBClient(dynamoDB)
.dynamoDBMapperConfig(config)
.build();
|
DynamoDBMapper(AmazonDynamoDB dynamoDB,
DynamoDBMapperConfig config,
AttributeTransformer transformer)
Deprecated.
Please use DynamoDBMapper.builder()
.dynamoDBClient(dynamoDB)
.dynamoDBMapperConfig(config)
.attributeTransformer(transformer)
.build();
|
DynamoDBMapper(AmazonDynamoDB dynamoDB,
DynamoDBMapperConfig config,
AttributeTransformer transformer,
AWSCredentialsProvider s3CredentialsProvider)
Deprecated.
Please use DynamoDBMapper.builder()
.dynamoDBClient(dynamoDB)
.dynamoDBMapperConfig(config)
.attributeTransformer(transformer)
.awsCredentialsProviderForS3(creds)
.build();
|
DynamoDBMapper(AmazonDynamoDB dynamoDB,
DynamoDBMapperConfig config,
AWSCredentialsProvider s3CredentialProvider)
Deprecated.
Please use DynamoDBMapper.builder()
.dynamoDBClient(dynamoDB)
.dynamoDBMapperConfig(config)
.awsCredentialsProviderForS3(creds)
.build();
|
Modifier and Type | Method and Description |
---|---|
java.util.List<DynamoDBMapper.FailedBatch> |
batchDelete(java.util.List<? extends java.lang.Object> objectsToDelete)
Deletes the objects given using one or more calls to the
AmazonDynamoDB.batchWriteItem(BatchWriteItemRequest) API. |
java.util.List<DynamoDBMapper.FailedBatch> |
batchDelete(java.lang.Object... objectsToDelete)
Deletes the objects given using one or more calls to the
AmazonDynamoDB.batchWriteItem(BatchWriteItemRequest) API. |
java.util.Map<java.lang.String,java.util.List<java.lang.Object>> |
batchLoad(java.util.List<java.lang.Object> itemsToGet)
Retrieves multiple items from multiple tables using their primary keys.
|
java.util.Map<java.lang.String,java.util.List<java.lang.Object>> |
batchLoad(java.util.List<java.lang.Object> itemsToGet,
DynamoDBMapperConfig config)
Retrieves multiple items from multiple tables using their primary keys.
|
java.util.Map<java.lang.String,java.util.List<java.lang.Object>> |
batchLoad(java.util.Map<java.lang.Class<?>,java.util.List<KeyPair>> itemsToGet)
Retrieves the attributes for multiple items from multiple tables using
their primary keys.
|
java.util.Map<java.lang.String,java.util.List<java.lang.Object>> |
batchLoad(java.util.Map<java.lang.Class<?>,java.util.List<KeyPair>> itemsToGet,
DynamoDBMapperConfig config)
Retrieves multiple items from multiple tables using their primary keys.
|
java.util.List<DynamoDBMapper.FailedBatch> |
batchSave(java.util.List<? extends java.lang.Object> objectsToSave)
Saves the objects given using one or more calls to the
AmazonDynamoDB.batchWriteItem(BatchWriteItemRequest) API. |
java.util.List<DynamoDBMapper.FailedBatch> |
batchSave(java.lang.Object... objectsToSave)
Saves the objects given using one or more calls to the
AmazonDynamoDB.batchWriteItem(BatchWriteItemRequest) API. |
java.util.List<DynamoDBMapper.FailedBatch> |
batchWrite(java.util.List<? extends java.lang.Object> objectsToWrite,
java.util.List<? extends java.lang.Object> objectsToDelete)
Saves and deletes the objects given using one or more calls to the
AmazonDynamoDB.batchWriteItem(BatchWriteItemRequest) API. |
java.util.List<DynamoDBMapper.FailedBatch> |
batchWrite(java.util.List<? extends java.lang.Object> objectsToWrite,
java.util.List<? extends java.lang.Object> objectsToDelete,
DynamoDBMapperConfig config)
Saves and deletes the objects given using one or more calls to the
AmazonDynamoDB.batchWriteItem(BatchWriteItemRequest) API. |
static DynamoDBMapper.Builder |
builder()
Minimum calls required.
|
int |
count(java.lang.Class<?> clazz,
DynamoDBScanExpression scanExpression)
Evaluates the specified scan expression and returns the count of matching
items, without returning any of the actual item data, using the default
configuration.
|
int |
count(java.lang.Class<?> clazz,
DynamoDBScanExpression scanExpression,
DynamoDBMapperConfig config)
Evaluates the specified scan expression and returns the count of matching
items, without returning any of the actual item data.
|
<T> int |
count(java.lang.Class<T> clazz,
DynamoDBQueryExpression<T> queryExpression)
Evaluates the specified query expression and returns the count of
matching items, without returning any of the actual item data, using the
default configuration.
|
<T> int |
count(java.lang.Class<T> clazz,
DynamoDBQueryExpression<T> queryExpression,
DynamoDBMapperConfig config)
Evaluates the specified query expression and returns the count of
matching items, without returning any of the actual item data.
|
S3Link |
createS3Link(Region s3region,
java.lang.String bucketName,
java.lang.String key)
Creates an S3Link with the specified region, bucket name and key.
|
S3Link |
createS3Link(java.lang.String bucketName,
java.lang.String key)
Creates an S3Link with the specified bucket name and key using the
default S3 region.
|
void |
delete(java.lang.Object object)
Deletes the given object from its DynamoDB table using the default
configuration.
|
void |
delete(java.lang.Object object,
DynamoDBDeleteExpression deleteExpression)
Deletes the given object from its DynamoDB table using the specified
deleteExpression and default configuration.
|
void |
delete(java.lang.Object object,
DynamoDBMapperConfig config)
Deletes the given object from its DynamoDB table using the specified
configuration.
|
<T> void |
delete(T object,
DynamoDBDeleteExpression deleteExpression,
DynamoDBMapperConfig config)
Deletes the given object from its DynamoDB table using the provided
deleteExpression and provided configuration.
|
CreateTableRequest |
generateCreateTableRequest(java.lang.Class<?> clazz)
Parse the given POJO class and return the CreateTableRequest for the
DynamoDB table it represents.
|
S3ClientCache |
getS3ClientCache()
Returns the underlying
S3ClientCache for accessing S3. |
<T> T |
load(java.lang.Class<T> clazz,
java.lang.Object hashKey)
Loads an object with the hash key given, using the default configuration.
|
<T> T |
load(java.lang.Class<T> clazz,
java.lang.Object hashKey,
DynamoDBMapperConfig config)
Loads an object with the hash key given and a configuration override.
|
<T> T |
load(java.lang.Class<T> clazz,
java.lang.Object hashKey,
java.lang.Object rangeKey)
Loads an object with a hash and range key, using the default
configuration.
|
<T> T |
load(java.lang.Class<T> clazz,
java.lang.Object hashKey,
java.lang.Object rangeKey,
DynamoDBMapperConfig config)
Returns an object with the given hash key, or null if no such object
exists.
|
<T> T |
load(T keyObject)
Returns an object whose keys match those of the prototype key object
given, or null if no such item exists.
|
<T> T |
load(T keyObject,
DynamoDBMapperConfig config)
Returns an object whose keys match those of the prototype key object
given, or null if no such item exists.
|
<T> T |
marshallIntoObject(java.lang.Class<T> clazz,
java.util.Map<java.lang.String,AttributeValue> itemAttributes)
Creates and fills in the attributes on an instance of the class given
with the attributes given.
|
<T> java.util.List<T> |
marshallIntoObjects(java.lang.Class<T> clazz,
java.util.List<java.util.Map<java.lang.String,AttributeValue>> itemAttributes)
Unmarshalls the list of item attributes into objects of type clazz.
|
<T> PaginatedParallelScanList<T> |
parallelScan(java.lang.Class<T> clazz,
DynamoDBScanExpression scanExpression,
int totalSegments)
Scans through an Amazon DynamoDB table on logically partitioned segments
in parallel and returns the matching results in one unmodifiable list of
instantiated objects, using the default configuration.
|
<T> PaginatedParallelScanList<T> |
parallelScan(java.lang.Class<T> clazz,
DynamoDBScanExpression scanExpression,
int totalSegments,
DynamoDBMapperConfig config)
Scans through an Amazon DynamoDB table on logically partitioned segments
in parallel.
|
<T> PaginatedQueryList<T> |
query(java.lang.Class<T> clazz,
DynamoDBQueryExpression<T> queryExpression)
Queries an Amazon DynamoDB table and returns the matching results as an
unmodifiable list of instantiated objects, using the default
configuration.
|
<T> PaginatedQueryList<T> |
query(java.lang.Class<T> clazz,
DynamoDBQueryExpression<T> queryExpression,
DynamoDBMapperConfig config)
Queries an Amazon DynamoDB table and returns the matching results as an
unmodifiable list of instantiated objects.
|
<T> QueryResultPage<T> |
queryPage(java.lang.Class<T> clazz,
DynamoDBQueryExpression<T> queryExpression)
Queries an Amazon DynamoDB table and returns a single page of matching
results.
|
<T> QueryResultPage<T> |
queryPage(java.lang.Class<T> clazz,
DynamoDBQueryExpression<T> queryExpression,
DynamoDBMapperConfig config)
Queries an Amazon DynamoDB table and returns a single page of matching
results.
|
<T> void |
save(T object)
Saves the object given into DynamoDB, using the default configuration.
|
<T> void |
save(T object,
DynamoDBMapperConfig config)
Saves the object given into DynamoDB, using the specified configuration.
|
<T> void |
save(T object,
DynamoDBSaveExpression saveExpression)
Saves the object given into DynamoDB, using the default configuration and
the specified saveExpression.
|
<T> void |
save(T object,
DynamoDBSaveExpression saveExpression,
DynamoDBMapperConfig config)
Saves an item in DynamoDB.
|
<T> PaginatedScanList<T> |
scan(java.lang.Class<T> clazz,
DynamoDBScanExpression scanExpression)
Scans through an Amazon DynamoDB table and returns the matching results
as an unmodifiable list of instantiated objects, using the default
configuration.
|
<T> PaginatedScanList<T> |
scan(java.lang.Class<T> clazz,
DynamoDBScanExpression scanExpression,
DynamoDBMapperConfig config)
Scans through an Amazon DynamoDB table and returns the matching results
as an unmodifiable list of instantiated objects.
|
<T> ScanResultPage<T> |
scanPage(java.lang.Class<T> clazz,
DynamoDBScanExpression scanExpression)
Scans through an Amazon DynamoDB table and returns a single page of
matching results.
|
<T> ScanResultPage<T> |
scanPage(java.lang.Class<T> clazz,
DynamoDBScanExpression scanExpression,
DynamoDBMapperConfig config)
Scans through an Amazon DynamoDB table and returns a single page of
matching results.
|
public DynamoDBMapper(AmazonDynamoDB dynamoDB)
dynamoDB
- The service object to use for all service calls.DynamoDBMapperConfig.DEFAULT
public DynamoDBMapper(AmazonDynamoDB dynamoDB, DynamoDBMapperConfig config)
dynamoDB
- The service object to use for all service calls.config
- The default configuration to use for all service calls. It
can be overridden on a per-operation basis.public DynamoDBMapper(AmazonDynamoDB ddb, AWSCredentialsProvider s3CredentialProvider)
ddb
- The service object to use for all service calls.s3CredentialProvider
- The credentials provider for accessing S3.
Relevant only if S3Link
is involved.DynamoDBMapperConfig.DEFAULT
public DynamoDBMapper(AmazonDynamoDB dynamoDB, DynamoDBMapperConfig config, AttributeTransformer transformer)
dynamoDB
- the service object to use for all service callsconfig
- the default configuration to use for all service calls. It
can be overridden on a per-operation basistransformer
- The custom attribute transformer to invoke when
serializing or deserializing an object.public DynamoDBMapper(AmazonDynamoDB dynamoDB, DynamoDBMapperConfig config, AWSCredentialsProvider s3CredentialProvider)
dynamoDB
- The service object to use for all service calls.config
- The default configuration to use for all service calls. It
can be overridden on a per-operation basis.s3CredentialProvider
- The credentials provider for accessing S3.
Relevant only if S3Link
is involved.public DynamoDBMapper(AmazonDynamoDB dynamoDB, DynamoDBMapperConfig config, AttributeTransformer transformer, AWSCredentialsProvider s3CredentialsProvider)
dynamoDB
- The service object to use for all service calls.config
- The default configuration to use for all service calls. It
can be overridden on a per-operation basis.transformer
- The custom attribute transformer to invoke when
serializing or deserializing an object.s3CredentialsProvider
- The credentials provider for accessing S3.
Relevant only if S3Link
is involved.public static DynamoDBMapper.Builder builder()
public <T> T load(java.lang.Class<T> clazz, java.lang.Object hashKey, DynamoDBMapperConfig config)
T
- the class typeclazz
- the classhashKey
- the hashkey objectconfig
- the DynamoDBMapperConfig
load(Class, Object, Object, DynamoDBMapperConfig)
public <T> T load(java.lang.Class<T> clazz, java.lang.Object hashKey)
T
- the class typeclazz
- the classhashKey
- the hashkey objectload(Class, Object, Object, DynamoDBMapperConfig)
public <T> T load(java.lang.Class<T> clazz, java.lang.Object hashKey, java.lang.Object rangeKey)
T
- the type of the class.clazz
- the class to type the obect to.hashKey
- the hash keyrangeKey
- the range keyload(Class, Object, Object, DynamoDBMapperConfig)
public <T> T load(T keyObject)
T
- the type of class.keyObject
- An object of the class to load with the keys values to
match.load(Object, DynamoDBMapperConfig)
public <T> T load(T keyObject, DynamoDBMapperConfig config)
T
- the type of class.keyObject
- An object of the class to load with the keys values to
match.config
- Configuration for the service call to retrieve the object
from DynamoDB. This configuration overrides the default given
at construction.public <T> T load(java.lang.Class<T> clazz, java.lang.Object hashKey, java.lang.Object rangeKey, DynamoDBMapperConfig config)
T
- the type of class.clazz
- The class to load, corresponding to a DynamoDB table.hashKey
- The key of the object.rangeKey
- The range key of the object, or null for tables without a
range key.config
- Configuration for the service call to retrieve the object
from DynamoDB. This configuration overrides the default given
at construction.public <T> T marshallIntoObject(java.lang.Class<T> clazz, java.util.Map<java.lang.String,AttributeValue> itemAttributes)
This is accomplished by looking for getter methods annotated with an appropriate annotation, then looking for matching attribute names in the item attribute map.
This method is no longer called by load/scan/query methods. If you are overriding this method, please switch to using an AttributeTransformer
T
- the type of object.clazz
- The class to instantiate and hydrateitemAttributes
- The set of item attributes, keyed by attribute
name.public <T> java.util.List<T> marshallIntoObjects(java.lang.Class<T> clazz, java.util.List<java.util.Map<java.lang.String,AttributeValue>> itemAttributes)
This method is no longer called by load/scan/query methods. If you are overriding this method, please switch to using an AttributeTransformer
T
- the type of object.clazz
- the class to marshall into.itemAttributes
- the item attributes.marshallIntoObject(Class, Map)
public <T> void save(T object)
T
- the type of object.object
- the object to save.save(Object, DynamoDBSaveExpression,
DynamoDBMapperConfig)
public <T> void save(T object, DynamoDBSaveExpression saveExpression)
T
- the type of object.object
- the object to save.saveExpression
- the DynamoDBSaveExpression
save(Object, DynamoDBSaveExpression,
DynamoDBMapperConfig)
public <T> void save(T object, DynamoDBMapperConfig config)
T
- the type of object.object
- the object to save.config
- the DynamoDBMapperConfig
save(Object, DynamoDBSaveExpression,
DynamoDBMapperConfig)
public <T> void save(T object, DynamoDBSaveExpression saveExpression, DynamoDBMapperConfig config)
DynamoDBMapperConfig.getSaveBehavior()
value, to use either
AmazonDynamoDB.putItem(PutItemRequest)
or
AmazonDynamoDB.updateItem(UpdateItemRequest)
:
T
- the type of object.object
- The object to save into DynamoDBsaveExpression
- The options to apply to this save requestconfig
- The configuration to use, which overrides the default
provided at object construction.DynamoDBMapperConfig.SaveBehavior
public void delete(java.lang.Object object)
object
- the object to delete.public void delete(java.lang.Object object, DynamoDBDeleteExpression deleteExpression)
object
- the object to delete.deleteExpression
- the DynamoDBDeleteExpression
public void delete(java.lang.Object object, DynamoDBMapperConfig config)
object
- the object to delete.config
- the DynamoDBMapperConfig
public <T> void delete(T object, DynamoDBDeleteExpression deleteExpression, DynamoDBMapperConfig config)
T
- the type of the object.deleteExpression
- The options to apply to this delete requestconfig
- Config override object. If DynamoDBMapperConfig.SaveBehavior.CLOBBER
is
supplied, version fields will not be considered when deleting
the object.object
- the object to delete.public java.util.List<DynamoDBMapper.FailedBatch> batchDelete(java.util.List<? extends java.lang.Object> objectsToDelete)
AmazonDynamoDB.batchWriteItem(BatchWriteItemRequest)
API. No
version checks are performed, as required by the API.objectsToDelete
- the objects to delete.batchWrite(List, List, DynamoDBMapperConfig)
public java.util.List<DynamoDBMapper.FailedBatch> batchDelete(java.lang.Object... objectsToDelete)
AmazonDynamoDB.batchWriteItem(BatchWriteItemRequest)
API. No
version checks are performed, as required by the API.objectsToDelete
- list of objects to delete.batchWrite(List, List, DynamoDBMapperConfig)
public java.util.List<DynamoDBMapper.FailedBatch> batchSave(java.util.List<? extends java.lang.Object> objectsToSave)
AmazonDynamoDB.batchWriteItem(BatchWriteItemRequest)
API. No
version checks are performed, as required by the API.
This method ignores any SaveBehavior set on the mapper, and always
behaves as if SaveBehavior.CLOBBER was specified, as the
AmazonDynamoDB.batchWriteItem() request does not support updating
existing items.
This method fails to save the batch if the size of an individual object in the batch exceeds 400 KB. For more information on batch restrictions see, http://docs.aws.amazon .com/amazondynamodb/latest/APIReference/API_BatchWriteItem.html
objectsToSave
- list of objects to save.batchWrite(List, List, DynamoDBMapperConfig)
public java.util.List<DynamoDBMapper.FailedBatch> batchSave(java.lang.Object... objectsToSave)
AmazonDynamoDB.batchWriteItem(BatchWriteItemRequest)
API. No
version checks are performed, as required by the API.
This method ignores any SaveBehavior set on the mapper, and always
behaves as if SaveBehavior.CLOBBER was specified, as the
AmazonDynamoDB.batchWriteItem() request does not support updating
existing items. *
This method fails to save the batch if the size of an individual object in the batch exceeds 400 KB. For more information on batch restrictions see, http://docs.aws.amazon .com/amazondynamodb/latest/APIReference/API_BatchWriteItem.html
objectsToSave
- list of objects to save.batchWrite(List, List, DynamoDBMapperConfig)
public java.util.List<DynamoDBMapper.FailedBatch> batchWrite(java.util.List<? extends java.lang.Object> objectsToWrite, java.util.List<? extends java.lang.Object> objectsToDelete)
AmazonDynamoDB.batchWriteItem(BatchWriteItemRequest)
API. No
version checks are performed, as required by the API.
This method ignores any SaveBehavior set on the mapper, and always
behaves as if SaveBehavior.CLOBBER was specified, as the
AmazonDynamoDB.batchWriteItem() request does not support updating
existing items.
This method fails to save the batch if the size of an individual object in the batch exceeds 400 KB. For more information on batch restrictions see, http://docs.aws.amazon .com/amazondynamodb/latest/APIReference/API_BatchWriteItem.html
objectsToWrite
- list of objects to write.objectsToDelete
- list of objects to delete.batchWrite(List, List, DynamoDBMapperConfig)
public java.util.List<DynamoDBMapper.FailedBatch> batchWrite(java.util.List<? extends java.lang.Object> objectsToWrite, java.util.List<? extends java.lang.Object> objectsToDelete, DynamoDBMapperConfig config)
AmazonDynamoDB.batchWriteItem(BatchWriteItemRequest)
API.
This method fails to save the batch if the size of an individual object in the batch exceeds 400 KB. For more information on batch restrictions see, http://docs.aws.amazon .com/amazondynamodb/latest/APIReference/API_BatchWriteItem.html
objectsToWrite
- A list of objects to save to DynamoDB. No
version checks are performed, as required by the
AmazonDynamoDB.batchWriteItem(BatchWriteItemRequest)
API.objectsToDelete
- A list of objects to delete from DynamoDB. No
version checks are performed, as required by the
AmazonDynamoDB.batchWriteItem(BatchWriteItemRequest)
API.config
- Only DynamoDBMapperConfig.getTableNameOverride()
is
considered; if specified, all objects in the two parameter
lists will be considered to belong to the given table
override. In particular, this method always acts as if
SaveBehavior.CLOBBER was specified regardless of the value
of the config parameter.public java.util.Map<java.lang.String,java.util.List<java.lang.Object>> batchLoad(java.util.List<java.lang.Object> itemsToGet)
itemsToGet
- list of items to get.batchLoad(List, DynamoDBMapperConfig)
public java.util.Map<java.lang.String,java.util.List<java.lang.Object>> batchLoad(java.util.List<java.lang.Object> itemsToGet, DynamoDBMapperConfig config)
itemsToGet
- Key objects, corresponding to the class to fetch, with
their primary key values set.config
- Only DynamoDBMapperConfig.getTableNameOverride()
and DynamoDBMapperConfig.getConsistentReads()
are
considered.public java.util.Map<java.lang.String,java.util.List<java.lang.Object>> batchLoad(java.util.Map<java.lang.Class<?>,java.util.List<KeyPair>> itemsToGet)
AmazonDynamoDB.batchGetItem(BatchGetItemRequest)
API.itemsToGet
- list of items to get.batchLoad(List, DynamoDBMapperConfig)
,
batchLoad(Map, DynamoDBMapperConfig)
public java.util.Map<java.lang.String,java.util.List<java.lang.Object>> batchLoad(java.util.Map<java.lang.Class<?>,java.util.List<KeyPair>> itemsToGet, DynamoDBMapperConfig config)
batchLoad(List, DynamoDBMapperConfig)
itemsToGet
- Map from class to load to list of primary key
attributes.config
- Only DynamoDBMapperConfig.getTableNameOverride()
and DynamoDBMapperConfig.getConsistentReads()
are
considered.public <T> PaginatedScanList<T> scan(java.lang.Class<T> clazz, DynamoDBScanExpression scanExpression)
T
- the type of the mapper class.clazz
- the mapper class.scanExpression
- the DynamoDBScanExpression
PaginatedScanList
scan(Class, DynamoDBScanExpression,
DynamoDBMapperConfig)
public <T> PaginatedScanList<T> scan(java.lang.Class<T> clazz, DynamoDBScanExpression scanExpression, DynamoDBMapperConfig config)
Callers should be aware that the returned list is unmodifiable, and any attempts to modify the list will result in an UnsupportedOperationException.
You can specify the pagination loading strategy for this scan operation. By default, the list returned is lazily loaded when possible.
T
- The type of the objects being returned.clazz
- The class annotated with DynamoDB annotations describing how
to store the object data in Amazon DynamoDB.scanExpression
- Details on how to run the scan, including any
filters to apply to limit results.config
- The configuration to use for this scan, which overrides the
default provided at object construction.PaginatedScanList
,
DynamoDBMapperConfig.PaginationLoadingStrategy
public <T> PaginatedParallelScanList<T> parallelScan(java.lang.Class<T> clazz, DynamoDBScanExpression scanExpression, int totalSegments)
T
- the type of the mapper class.clazz
- the mapper class.scanExpression
- the DynamoDBScanExpression
totalSegments
- the total segmentsPaginatedParallelScanList
parallelScan(Class, DynamoDBScanExpression,int,
DynamoDBMapperConfig)
public <T> PaginatedParallelScanList<T> parallelScan(java.lang.Class<T> clazz, DynamoDBScanExpression scanExpression, int totalSegments, DynamoDBMapperConfig config)
Callers should be aware that the returned list is unmodifiable, and any attempts to modify the list will result in an UnsupportedOperationException.
You can specify the pagination loading strategy for this parallel scan operation. By default, the list returned is lazily loaded when possible.
T
- The type of the objects being returned.clazz
- The class annotated with DynamoDB annotations describing how
to store the object data in Amazon DynamoDB.scanExpression
- Details on how to run the scan, including any
filters to apply to limit results.totalSegments
- Number of total parallel scan segments. Range:
1 - 4096config
- The configuration to use for this scan, which overrides the
default provided at object construction.PaginatedParallelScanList
,
DynamoDBMapperConfig.PaginationLoadingStrategy
public <T> ScanResultPage<T> scanPage(java.lang.Class<T> clazz, DynamoDBScanExpression scanExpression, DynamoDBMapperConfig config)
T
- The type of the objects being returned.clazz
- The class annotated with DynamoDB annotations describing how
to store the object data in Amazon DynamoDB.scanExpression
- Details on how to run the scan, including any
filters to apply to limit results.config
- The configuration to use for this scan, which overrides the
default provided at object construction.public <T> ScanResultPage<T> scanPage(java.lang.Class<T> clazz, DynamoDBScanExpression scanExpression)
T
- the type of the object.clazz
- the mapper class.scanExpression
- the DynamoDBScanExpression
scanPage(Class, DynamoDBScanExpression,
DynamoDBMapperConfig)
public <T> PaginatedQueryList<T> query(java.lang.Class<T> clazz, DynamoDBQueryExpression<T> queryExpression)
T
- the type of the object.clazz
- the mapper class.queryExpression
- the DynamoDBQueryExpression
query(Class, DynamoDBQueryExpression,
DynamoDBMapperConfig)
public <T> PaginatedQueryList<T> query(java.lang.Class<T> clazz, DynamoDBQueryExpression<T> queryExpression, DynamoDBMapperConfig config)
When the query is on any local/global secondary index, callers should be aware that the returned object(s) will only contain item attributes that are projected into the index. All the other unprojected attributes will be saved as type default values.
Callers should also be aware that the returned list is unmodifiable, and any attempts to modify the list will result in an UnsupportedOperationException.
You can specify the pagination loading strategy for this query operation. By default, the list returned is lazily loaded when possible.
T
- The type of the objects being returned.clazz
- The class annotated with DynamoDB annotations describing how
to store the object data in Amazon DynamoDB.queryExpression
- Details on how to run the query, including any
conditions on the key valuesconfig
- The configuration to use for this query, which overrides
the default provided at object construction.PaginatedQueryList
,
DynamoDBMapperConfig.PaginationLoadingStrategy
public <T> QueryResultPage<T> queryPage(java.lang.Class<T> clazz, DynamoDBQueryExpression<T> queryExpression)
T
- The type of the objects being returned.clazz
- The class annotated with DynamoDB annotations describing how
to store the object data in Amazon DynamoDB.queryExpression
- Details on how to run the query, including any
conditions on the key valuesqueryPage(Class, DynamoDBQueryExpression,
DynamoDBMapperConfig)
public <T> QueryResultPage<T> queryPage(java.lang.Class<T> clazz, DynamoDBQueryExpression<T> queryExpression, DynamoDBMapperConfig config)
T
- The type of the objects being returned.clazz
- The class annotated with DynamoDB annotations describing how
to store the object data in AWS DynamoDB.queryExpression
- Details on how to run the query, including any
conditions on the key valuesconfig
- The configuration to use for this query, which overrides
the default provided at object construction.public int count(java.lang.Class<?> clazz, DynamoDBScanExpression scanExpression)
clazz
- the type of mapper class.scanExpression
- the DynamoDBScanExpression
.count(Class, DynamoDBScanExpression,
DynamoDBMapperConfig)
public int count(java.lang.Class<?> clazz, DynamoDBScanExpression scanExpression, DynamoDBMapperConfig config)
This operation will scan your entire table, and can therefore be very expensive. Use with caution.
clazz
- The class mapped to a DynamoDB table.scanExpression
- The parameters for running the scan.config
- The configuration to use for this scan, which overrides the
default provided at object construction.public <T> int count(java.lang.Class<T> clazz, DynamoDBQueryExpression<T> queryExpression)
T
- the type of mapper classclazz
- The class mapped to a DynamoDB table.queryExpression
- the DynamoDBQueryExpression
count(Class, DynamoDBQueryExpression,
DynamoDBMapperConfig)
public <T> int count(java.lang.Class<T> clazz, DynamoDBQueryExpression<T> queryExpression, DynamoDBMapperConfig config)
T
- the type of the object.clazz
- The class mapped to a DynamoDB table.queryExpression
- The parameters for running the scan.config
- The mapper configuration to use for the query, which
overrides the default provided at object construction.public S3ClientCache getS3ClientCache()
S3ClientCache
for accessing S3.S3ClientCache
for accessing S3.public S3Link createS3Link(java.lang.String bucketName, java.lang.String key)
bucketName
- the bucket name.key
- the object keyS3Link
with specified bucket name and key.java.lang.IllegalStateException
- if the mapper has not been constructed with
the necessary S3 AWS credentials.public S3Link createS3Link(Region s3region, java.lang.String bucketName, java.lang.String key)
s3region
- the s3 regionbucketName
- the bucket name.key
- the object keyS3Link
with specified bucket name and key.java.lang.IllegalStateException
- if the mapper has not been constructed with
the necessary S3 AWS credentials.public CreateTableRequest generateCreateTableRequest(java.lang.Class<?> clazz)
clazz
- the mapper class.CreateTableRequest
Copyright © 2018 Amazon Web Services, Inc. All Rights Reserved.