Skip to content

Handled surface api comments of removing Generic access as Objects #3811

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ providers.

// New API in TableSchema to create a DocumentTableSchema
DocumentTableSchema documentTableSchema =
TableSchema.fromDocumentSchemaBuilder()
TableSchema.documentSchemaBuilder()
.addIndexPartitionKey(primaryIndexName(), "sample_hash_name", AttributeValueType.S)
.addIndexSortKey("gsi_index", "sample_sort_name", AttributeValueType.N)
.addAttributeConverterProviders(cutomAttributeConverters)
Expand Down Expand Up @@ -78,7 +78,7 @@ EnhancedDocument documentTableItem = documentTable.getItem(
Number sampleSortvalue = documentTableItem.get("sample_sort_name", EnhancedType.of(Number.class));

// Accessing an attribute from document using specific getters.
sampleSortvalue = documentTableItem.getSdkNumber("sample_sort_name");
sampleSortvalue = documentTableItem.getNumber("sample_sort_name");

// Accessing an attribute of custom class using custom converters.
CustomClass customClass = documentTableItem.get("custom_nested_map", new CustomAttributeConverter()));
Expand Down
5 changes: 5 additions & 0 deletions services-custom/dynamodb-enhanced/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@
<artifactId>aws-core</artifactId>
<version>${awsjavasdk.version}</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>json-utils</artifactId>
<version>${awsjavasdk.version}</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>http-client-spi</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import software.amazon.awssdk.enhanced.dynamodb.internal.converter.attribute.OptionalLongAttributeConverter;
import software.amazon.awssdk.enhanced.dynamodb.internal.converter.attribute.PeriodAttributeConverter;
import software.amazon.awssdk.enhanced.dynamodb.internal.converter.attribute.SdkBytesAttributeConverter;
import software.amazon.awssdk.enhanced.dynamodb.internal.converter.attribute.SdkNumberAttributeConverter;
import software.amazon.awssdk.enhanced.dynamodb.internal.converter.attribute.SetAttributeConverter;
import software.amazon.awssdk.enhanced.dynamodb.internal.converter.attribute.ShortAttributeConverter;
import software.amazon.awssdk.enhanced.dynamodb.internal.converter.attribute.StringAttributeConverter;
Expand Down Expand Up @@ -88,7 +89,7 @@
@ThreadSafe
@Immutable
public final class DefaultAttributeConverterProvider implements AttributeConverterProvider {
private static DefaultAttributeConverterProvider INSTANCE = getDefaultBuilder().build();
private static final DefaultAttributeConverterProvider INSTANCE = getDefaultBuilder().build();

private static final Logger log = Logger.loggerFor(DefaultAttributeConverterProvider.class);

Expand Down Expand Up @@ -247,7 +248,8 @@ private static Builder getDefaultBuilder() {
.addConverter(UuidAttributeConverter.create())
.addConverter(ZonedDateTimeAsStringAttributeConverter.create())
.addConverter(ZoneIdAttributeConverter.create())
.addConverter(ZoneOffsetAttributeConverter.create());
.addConverter(ZoneOffsetAttributeConverter.create())
.addConverter(SdkNumberAttributeConverter.create());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
import java.util.Map;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.enhanced.dynamodb.document.EnhancedDocument;
import software.amazon.awssdk.enhanced.dynamodb.mapper.BeanTableSchema;
import software.amazon.awssdk.enhanced.dynamodb.mapper.DocumentTableSchema;
import software.amazon.awssdk.enhanced.dynamodb.mapper.ImmutableTableSchema;
import software.amazon.awssdk.enhanced.dynamodb.mapper.StaticImmutableTableSchema;
import software.amazon.awssdk.enhanced.dynamodb.mapper.StaticTableSchema;
Expand Down Expand Up @@ -84,6 +86,16 @@ static <T> BeanTableSchema<T> fromBean(Class<T> beanClass) {
return BeanTableSchema.create(beanClass);
}

/**
* Provides interfaces to interact with DynamoDB tables as {@link EnhancedDocument} where the complete Schema of the table is
* not required.
*
* @return A {@link DocumentTableSchema.Builder} for instantiating DocumentTableSchema.
*/
static DocumentTableSchema.Builder documentSchemaBuilder() {
return DocumentTableSchema.builder();
}

/**
* Scans an immutable class that has been annotated with DynamoDb immutable annotations and then returns a
* {@link ImmutableTableSchema} implementation of this interface that can map records to and from items of that
Expand Down
Loading