Open
Description
We should support reading/writing base types using the DynamoDB Enhanced Client.
Potential syntax/example (not yet implemented):
@DynamoDbBean
@DynamoDbSubtypes({Employee.class, Customer.class})
public abstract class Person {
@DynamoDBHashKey
private long id;
private String name;
}
@DynamoDbBean
private class Employee extends Person {
}
@DynamoDbBean
private class Customer extends Person {
}
DynamoDbEnhancedClient client = DynamoDbEnhancedClient.create();
DynamoDbTable<Person> people = client.table("people", TableSchema.fromBean(Person.class));
Employee bob = new Employee();
bob.setId(1);
bob.setName("Bob the Builder");
Customer lfh = new Customer();
lfh.setId(2);
lfh.setName("Low Flying Hawk");
people.putItem(bob);
people.putItem(lfh);
assertThat(people.getItem(Key.builder().partitionValue(1).build())).isInstanceOf(Employee.class);
assertThat(people.getItem(Key.builder().partitionValue(2).build())).isInstanceOf(Customer.class);
Activity