@Retention(value=RUNTIME) @Target(value={FIELD,METHOD}) public @interface DynamoDBAutoGeneratedTimestamp
@DynamoDBTable(tableName="TestTable")
public class TestClass {
private String key;
private Date createdDate;
private Date lastUpdatedDate;
@DynamoDBHashKey
public String getKey() { return key; }
public void setKey(String key) { this.key = key; }
@DynamoDBAutoGeneratedTimestamp(strategy=DynamoDBAutoGenerateStrategy.CREATE)
public Date getCreatedDate() { return createdDate; }
public void setCreatedDate(Date createdDate) { this.createdDate = createdDate; }
@DynamoDBAutoGeneratedTimestamp(strategy=DynamoDBAutoGenerateStrategy.ALWAYS)
public Date getLastUpdatedDate() { return lastUpdatedDate; }
public void setLastUpdatedDate(Date lastUpdatedDate) { this.lastUpdatedDate = lastUpdatedDate; }
}
Please note,
Only Calendar, Date and Long are
supported for now. Primitives such as long are not supported since
the unset (or null) state can't be detected.DynamoDBAutoGenerateStrategy| Modifier and Type | Optional Element and Description |
|---|---|
DynamoDBAutoGenerateStrategy |
strategy
The auto-generation strategy; default is
ALWAYS. |
public abstract DynamoDBAutoGenerateStrategy strategy
ALWAYS.DynamoDBAutoGenerateStrategyCopyright © 2016. All rights reserved.