Class AbstractScanBuilder<T, S extends AbstractScanBuilder<T,S>>
java.lang.Object
dev.hogwai.dynamodb.simplified.builder.base.AbstractScanBuilder<T,S>
- Type Parameters:
T- the item typeS- the concrete builder type (for fluent chaining)
- Direct Known Subclasses:
AsyncScanBuilder, ScanBuilder
Abstract base for sync and async scan builders.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BooleanWhether to use strongly consistent reads (falseby default).Exclusive start key for paginated scans.protected FilterExpressionOptional filter expression applied after the scan.protected IntegerMaximum number of items to evaluate per page.protected static final org.slf4j.LoggerLogger for this builder class.protected ProjectionExpressionOptional projection expression to restrict returned attributes.protected software.amazon.awssdk.services.dynamodb.model.ReturnConsumedCapacityOptional consumed capacity reporting level.protected IntegerThe segment index for this scan worker (0-based).protected software.amazon.awssdk.services.dynamodb.model.SelectOptional select parameter controlling which attributes are returned.protected IntegerTotal number of segments for a parallel scan. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs a newAbstractScanBuilder. -
Method Summary
Modifier and TypeMethodDescriptionprotected @NonNull software.amazon.awssdk.services.dynamodb.model.ScanRequestbuildCountRequest(@NonNull software.amazon.awssdk.services.dynamodb.model.Select select) Builds a low-levelScanRequestfor count operations using the givenSelectmode.protected @NonNull software.amazon.awssdk.enhanced.dynamodb.model.ScanEnhancedRequestBuilds a high-levelScanEnhancedRequestfrom the configured parameters.@NonNull SconsistentRead(boolean consistentRead) Enables or disables strongly consistent reads.@NonNull Sfilter(@Nullable FilterExpression filter) Configures a scan filter expression from a pre-builtFilterExpression.@NonNull SConfigures a scan filter from a map of attribute-value pairs.@NonNull Sfilter(@NonNull Consumer<FilterExpression> filterBuilder) Configures a scan filter expression using aFilterExpressionconsumer.protected abstract @Nullable StringReturns the DynamoDB index name, ornullif the scan targets the base table.@NonNull Slimit(int limit) Limits the number of items evaluated per page.@NonNull SparallelScan(int totalSegments, int segment) Configures a parallel scan by specifying the total number of segments and the segment index for this scan worker.@NonNull SRestricts the returned attributes to the specified ones.@NonNull Sproject(@NonNull Consumer<ProjectionExpression> projectionBuilder) Restricts the returned attributes by configuring aProjectionExpressionvia a consumer.@NonNull SreturnConsumedCapacity(@NonNull software.amazon.awssdk.services.dynamodb.model.ReturnConsumedCapacity returnConsumedCapacity) Configures the level of consumed capacity that should be returned by the scan.@NonNull Sselect(@Nullable software.amazon.awssdk.services.dynamodb.model.Select select) Sets the select parameter for the scan, controlling which attributes are returned.protected abstract Sself()Returnsthistyped asSfor fluent chaining.@NonNull SstartFrom(@Nullable Map<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue> lastEvaluatedKey) Sets the exclusive start key for paginated scans.protected abstract @NonNull StringReturns the DynamoDB table name.
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOGLogger for this builder class. -
filterExpression
Optional filter expression applied after the scan. -
projectionExpression
Optional projection expression to restrict returned attributes. -
limit
Maximum number of items to evaluate per page. -
exclusiveStartKey
-
consistentRead
Whether to use strongly consistent reads (falseby default). -
returnConsumedCapacity
protected software.amazon.awssdk.services.dynamodb.model.ReturnConsumedCapacity returnConsumedCapacityOptional consumed capacity reporting level. -
select
protected software.amazon.awssdk.services.dynamodb.model.Select selectOptional select parameter controlling which attributes are returned. -
totalSegments
Total number of segments for a parallel scan. -
segment
The segment index for this scan worker (0-based).
-
-
Constructor Details
-
AbstractScanBuilder
protected AbstractScanBuilder()Constructs a newAbstractScanBuilder.
-
-
Method Details
-
self
-
tableName
Returns the DynamoDB table name.- Returns:
- the DynamoDB table name
-
indexName
Returns the DynamoDB index name, ornullif the scan targets the base table.- Returns:
- the index name, or
nullfor the base table
-
filter
Configures a scan filter expression using aFilterExpressionconsumer.- Parameters:
filterBuilder- a consumer that configures theFilterExpression- Returns:
- this builder for chaining
-
filter
Configures a scan filter expression from a pre-builtFilterExpression.- Parameters:
filter- the filter expression- Returns:
- this builder for chaining
-
filter
Configures a scan filter from a map of attribute-value pairs.All conditions are combined with AND. Each entry is treated as an equality filter. For other condition types, use
filter(Consumer).- Parameters:
conditions- a map of attribute names to their expected values- Returns:
- this builder for chaining
-
project
-
project
Restricts the returned attributes by configuring aProjectionExpressionvia a consumer.- Parameters:
projectionBuilder- a consumer that configures theProjectionExpression- Returns:
- this builder for chaining
-
parallelScan
Configures a parallel scan by specifying the total number of segments and the segment index for this scan worker.- Parameters:
totalSegments- the total number of segments to divide the table intosegment- the segment index for this worker (0-based)- Returns:
- this builder for chaining
-
limit
Limits the number of items evaluated per page.- Parameters:
limit- the maximum number of items to evaluate per page- Returns:
- this builder for chaining
-
startFrom
public @NonNull S startFrom(@Nullable Map<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue> lastEvaluatedKey) Sets the exclusive start key for paginated scans. Typically obtained from thePagedResult.lastEvaluatedKey()of a previous scan.- Parameters:
lastEvaluatedKey- the key map from which to start the next page- Returns:
- this builder for chaining
-
consistentRead
Enables or disables strongly consistent reads.- Parameters:
consistentRead-truefor a strongly consistent read,false(the default) for an eventually consistent read- Returns:
- this builder for chaining
-
returnConsumedCapacity
public @NonNull S returnConsumedCapacity(@NonNull software.amazon.awssdk.services.dynamodb.model.ReturnConsumedCapacity returnConsumedCapacity) Configures the level of consumed capacity that should be returned by the scan.- Parameters:
returnConsumedCapacity- theReturnConsumedCapacityvalue- Returns:
- this builder for chaining
-
select
Sets the select parameter for the scan, controlling which attributes are returned. UseSelect.COUNTto request only the item count from the server.- Parameters:
select- the select parameter (nullable)- Returns:
- this builder for chaining
-
buildScanRequest
protected @NonNull software.amazon.awssdk.enhanced.dynamodb.model.ScanEnhancedRequest buildScanRequest()Builds a high-levelScanEnhancedRequestfrom the configured parameters.- Returns:
- the built scan request
-
buildCountRequest
protected @NonNull software.amazon.awssdk.services.dynamodb.model.ScanRequest buildCountRequest(@NonNull software.amazon.awssdk.services.dynamodb.model.Select select) Builds a low-levelScanRequestfor count operations using the givenSelectmode.- Parameters:
select- the select mode (typicallySelect.COUNT)- Returns:
- the built scan request
-