Class DynamoDBMapperConfig
java.lang.Object
com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperConfig
Immutable configuration object for service call behavior. An instance of this
configuration is supplied to every
DynamoDBMapper at construction; if
not provided explicitly, DEFAULT is used. New
instances can be given to the mapper object on individual save, load, and
delete operations to override the defaults. For example:
DynamoDBMapper mapper = new DynamoDBMapper(dynamoDBClient);
// Force this read to be consistent
DomainClass obj = mapper.load(DomainClass.class, key, new DynamoDBMapperConfig(ConsistentReads.CONSISTENT));
// Force this save operation to use putItem rather than updateItem
mapper.save(obj, new DynamoDBMapperConfig(SaveBehavior.CLOBBER));
// Save the object into a different table
mapper.save(obj, new DynamoDBMapperConfig(new TableNameOverride("AnotherTable")));
// Delete the object even if the version field is out of date
mapper.delete(obj, new DynamoDBMapperConfig(SaveBehavior.CLOBBER));
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDynamoDBMapper#batchWrite takes arbitrary number of save/delete requests and breaks them into smaller chunks that can be accepted by the service API.static classA fluent builder for DynamoDBMapperConfig objects.static enumEnumeration of consistent read behavior.static classThe default BatchWriteRetryStrategy which always retries on UnprocessedItem up to a maximum number of times and use exponential backoff with random scale factor.static classDefault implementation ofDynamoDBMapperConfig.TableNameResolverthat mimics the behavior of DynamoDBMapper before the addition ofDynamoDBMapperConfig.TableNameResolver.static interfaceInterface for a strategy used to determine the table name of an object based on it's class.static enumEnumeration of pagination loading strategy.static enumEnumeration of behaviors for the save operation.static final classAllows overriding the table name declared on a domain class by theDynamoDBTableannotation.static interfaceInterface for a strategy used to determine the table name of an object based on it's class. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DynamoDBMapperConfigDefault configuration uses UPDATE behavior for saves and EVENTUALly consistent reads, with no table name override and lazy-loading strategy. -
Constructor Summary
ConstructorsConstructorDescriptionDynamoDBMapperConfig(ConversionSchema conversionSchema) Constructs a new configuration object with the conversion schema given.DynamoDBMapperConfig(DynamoDBMapperConfig.ConsistentReads consistentReads) Constructs a new configuration object with the consistent read behavior given.DynamoDBMapperConfig(DynamoDBMapperConfig.ObjectTableNameResolver objectTableNameResolver) Constructs a new configuration object with the object table name resolver strategy given.DynamoDBMapperConfig(DynamoDBMapperConfig.PaginationLoadingStrategy paginationLoadingStrategy) Constructs a new configuration object with the pagination loading strategy given.DynamoDBMapperConfig(DynamoDBMapperConfig.SaveBehavior saveBehavior) Constructs a new configuration object with the save behavior given.DynamoDBMapperConfig(DynamoDBMapperConfig.SaveBehavior saveBehavior, DynamoDBMapperConfig.ConsistentReads consistentReads, DynamoDBMapperConfig.TableNameOverride tableNameOverride) Deprecated.DynamoDBMapperConfig(DynamoDBMapperConfig.SaveBehavior saveBehavior, DynamoDBMapperConfig.ConsistentReads consistentReads, DynamoDBMapperConfig.TableNameOverride tableNameOverride, DynamoDBMapperConfig.PaginationLoadingStrategy paginationLoadingStrategy) Deprecated.in favor of the fluentBuilderDynamoDBMapperConfig(DynamoDBMapperConfig.SaveBehavior saveBehavior, DynamoDBMapperConfig.ConsistentReads consistentReads, DynamoDBMapperConfig.TableNameOverride tableNameOverride, DynamoDBMapperConfig.PaginationLoadingStrategy paginationLoadingStrategy, RequestMetricCollector requestMetricCollector) Deprecated.in favor of the fluentBuilderDynamoDBMapperConfig(DynamoDBMapperConfig.TableNameOverride tableNameOverride) Constructs a new configuration object with the table name override given.DynamoDBMapperConfig(DynamoDBMapperConfig.TableNameResolver tableNameResolver) Constructs a new configuration object with the table name resolver strategy given.DynamoDBMapperConfig(DynamoDBMapperConfig.TableNameResolver tableNameResolver, DynamoDBMapperConfig.ObjectTableNameResolver objectTableNameResolver) Constructs a new configuration object with the table name resolver strategies given.DynamoDBMapperConfig(DynamoDBMapperConfig defaults, DynamoDBMapperConfig overrides) Constructs a new configuration object from two others: a set of defaults and a set of overrides. -
Method Summary
Modifier and TypeMethodDescriptionReturns the consistent read behavior for this configuration.Returns the object table name resolver for this configuration.Returns the pagination loading strategy for this configuration.Returns the request metric collector or null if not specified.Returns the save behavior for this configuration.Returns the table name override for this configuration.Returns the table name resolver for this configuration.
-
Field Details
-
DEFAULT
Default configuration uses UPDATE behavior for saves and EVENTUALly consistent reads, with no table name override and lazy-loading strategy.
-
-
Constructor Details
-
DynamoDBMapperConfig
@Deprecated public DynamoDBMapperConfig(DynamoDBMapperConfig.SaveBehavior saveBehavior, DynamoDBMapperConfig.ConsistentReads consistentReads, DynamoDBMapperConfig.TableNameOverride tableNameOverride) Deprecated.in favor of the fluentDynamoDBMapperConfig.BuilderLegacy constructor, using default PaginationLoadingStrategy -
DynamoDBMapperConfig
@Deprecated public DynamoDBMapperConfig(DynamoDBMapperConfig.SaveBehavior saveBehavior, DynamoDBMapperConfig.ConsistentReads consistentReads, DynamoDBMapperConfig.TableNameOverride tableNameOverride, DynamoDBMapperConfig.PaginationLoadingStrategy paginationLoadingStrategy) Deprecated.in favor of the fluentBuilderConstructs a new configuration object with the save behavior, consistent read behavior, and table name override given.- Parameters:
saveBehavior- TheDynamoDBMapperConfig.SaveBehaviorto use, or null for default.consistentReads- TheDynamoDBMapperConfig.ConsistentReadsto use, or null for default.tableNameOverride- An override for the table name, or null for no override.paginationLoadingStrategy- The pagination loading strategy, or null for default.
-
DynamoDBMapperConfig
@Deprecated public DynamoDBMapperConfig(DynamoDBMapperConfig.SaveBehavior saveBehavior, DynamoDBMapperConfig.ConsistentReads consistentReads, DynamoDBMapperConfig.TableNameOverride tableNameOverride, DynamoDBMapperConfig.PaginationLoadingStrategy paginationLoadingStrategy, RequestMetricCollector requestMetricCollector) Deprecated.in favor of the fluentBuilderConstructs a new configuration object with the save behavior, consistent read behavior, and table name override given.- Parameters:
saveBehavior- TheDynamoDBMapperConfig.SaveBehaviorto use, or null for default.consistentReads- TheDynamoDBMapperConfig.ConsistentReadsto use, or null for default.tableNameOverride- An override for the table name, or null for no override.paginationLoadingStrategy- The pagination loading strategy, or null for default.requestMetricCollector- optional request metric collector
-
DynamoDBMapperConfig
Constructs a new configuration object with the save behavior given. -
DynamoDBMapperConfig
Constructs a new configuration object with the consistent read behavior given. -
DynamoDBMapperConfig
Constructs a new configuration object with the table name override given. -
DynamoDBMapperConfig
Constructs a new configuration object with the table name resolver strategy given. -
DynamoDBMapperConfig
Constructs a new configuration object with the object table name resolver strategy given. -
DynamoDBMapperConfig
public DynamoDBMapperConfig(DynamoDBMapperConfig.TableNameResolver tableNameResolver, DynamoDBMapperConfig.ObjectTableNameResolver objectTableNameResolver) Constructs a new configuration object with the table name resolver strategies given. -
DynamoDBMapperConfig
public DynamoDBMapperConfig(DynamoDBMapperConfig.PaginationLoadingStrategy paginationLoadingStrategy) Constructs a new configuration object with the pagination loading strategy given. -
DynamoDBMapperConfig
Constructs a new configuration object with the conversion schema given. -
DynamoDBMapperConfig
Constructs a new configuration object from two others: a set of defaults and a set of overrides. Any non-null overrides will be applied to the defaults.Used internally to merge the
DynamoDBMapperConfigprovided at construction with an overriding object for a particular operation.- Parameters:
defaults- The default mapper configuration values.overrides- The overridden mapper configuration values. Any non-null config settings will be applied to the returned object.
-
-
Method Details
-
getSaveBehavior
Returns the save behavior for this configuration. -
getConsistentReads
Returns the consistent read behavior for this configuration. -
getTableNameOverride
Returns the table name override for this configuration. This value will override the table name specified in aDynamoDBTableannotation, either by replacing the table name entirely or else by pre-pending a string to each table name. This is useful for partitioning data in multiple tables at runtime.- See Also:
-
getTableNameResolver
Returns the table name resolver for this configuration. This value will be used to determine the table name for classes. It can be used for more powerful customization of table name than is possible using onlyDynamoDBMapperConfig.TableNameOverride.- See Also:
-
getObjectTableNameResolver
Returns the object table name resolver for this configuration. This value will be used to determine the table name for objects. It can be used for more powerful customization of table name than is possible using onlyDynamoDBMapperConfig.TableNameOverride.- See Also:
-
getPaginationLoadingStrategy
Returns the pagination loading strategy for this configuration. -
getRequestMetricCollector
Returns the request metric collector or null if not specified. -
getConversionSchema
- Returns:
- the conversion schema for this config object
-
getBatchWriteRetryStrategy
- Returns:
- the BatchWriteRetryStrategy for this config object
-
DynamoDBMapperConfig.Builder