Class AbstractGetItemBuilder<T, S extends AbstractGetItemBuilder<T,S>>
java.lang.Object
dev.hogwai.dynamodb.simplified.builder.base.AbstractGetItemBuilder<T,S>
- Type Parameters:
T- the item typeS- the concrete builder type (for fluent chaining)
- Direct Known Subclasses:
AsyncGetItemBuilder, GetItemBuilder
public abstract class AbstractGetItemBuilder<T, S extends AbstractGetItemBuilder<T,S>>
extends Object
Abstract base for sync and async get-item builders.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether to use strongly consistent reads (falseby default).protected static final org.slf4j.LoggerLogger for this builder class.protected final ObjectThe partition key value.protected ProjectionExpressionOptional projection expression to restrict returned attributes.protected final @Nullable ObjectThe sort key value, ornullif the table has no sort key. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractGetItemBuilder(@NonNull Object partitionKey, @Nullable Object sortKey) Constructs a newAbstractGetItemBuilderwith the given key values. -
Method Summary
Modifier and TypeMethodDescriptionprotected @NonNull software.amazon.awssdk.enhanced.dynamodb.model.GetItemEnhancedRequestBuilds a high-levelGetItemEnhancedRequestfrom the current key and settings.buildKeyMap(@NonNull String pkName, @Nullable String skName) Builds a key map for low-level requests using the given key attribute names.protected @NonNull software.amazon.awssdk.services.dynamodb.model.GetItemRequestbuildLowLevelRequest(@NonNull Map<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue> keyMap) Builds a low-levelGetItemRequestfrom the given key map.@NonNull SconsistentRead(boolean consistentRead) Enables or disables strongly consistent reads.@NonNull SRestricts the returned attributes to the specified ones.@NonNull Sproject(@NonNull Consumer<ProjectionExpression> projectionBuilder) Restricts the returned attributes by configuring aProjectionExpressionvia a consumer.protected abstract Sself()Returnsthistyped asSfor fluent chaining.protected abstract @NonNull StringReturns the DynamoDB table name.
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOGLogger for this builder class. -
partitionKey
The partition key value. -
sortKey
The sort key value, ornullif the table has no sort key. -
projectionExpression
Optional projection expression to restrict returned attributes. -
consistentRead
protected boolean consistentReadWhether to use strongly consistent reads (falseby default).
-
-
Constructor Details
-
AbstractGetItemBuilder
-
-
Method Details
-
self
-
project
-
project
Restricts the returned attributes by configuring aProjectionExpressionvia a consumer.- Parameters:
projectionBuilder- a consumer that configures theProjectionExpression- 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
-
buildEnhancedRequest
protected @NonNull software.amazon.awssdk.enhanced.dynamodb.model.GetItemEnhancedRequest buildEnhancedRequest()Builds a high-levelGetItemEnhancedRequestfrom the current key and settings.- Returns:
- the built enhanced request
-
buildLowLevelRequest
protected @NonNull software.amazon.awssdk.services.dynamodb.model.GetItemRequest buildLowLevelRequest(@NonNull Map<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue> keyMap) Builds a low-levelGetItemRequestfrom the given key map. Requires a non-nullprojectionExpression.- Parameters:
keyMap- the key attribute map- Returns:
- the built low-level request
-
buildKeyMap
protected @NonNull Map<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue> buildKeyMap(@NonNull String pkName, @Nullable String skName) Builds a key map for low-level requests using the given key attribute names.- Parameters:
pkName- the partition key attribute nameskName- the sort key attribute name, ornullif none- Returns:
- the built key map
-
tableName
Returns the DynamoDB table name.- Returns:
- the DynamoDB table name
-