I'm working on an Android application which has a purpose to create a DynamoDB table every week. I'm getting the current week number:
Time time = new Time();
time.setToNow();
curweekNumb = time.getWeekNumber();
So I want to modify the table name as:
Constants.TEST_TABLE_NAME = "Week_" + currentweekNumb;
Whenever the currentweekNumb value changes.
The Constants class:
public class Constants {
public static String TEST_TABLE_NAME = "Week_1";
}
The main issue here, is that I'm getting an error indicating that the value for annotation attribute DynamoDBTable.tableName must be a constant expression. So it requires a "final" String value as a tableName. In this case, I'm not able to change that value anywhere in the application. Is it impossible to dynamically change a table name in the application ?.
@DynamoDBTable(tableName = Constants.TEST_TABLE_NAME) <--- The error is on this line
public static class UserPreference {
private int Tid;
private String Mandag;
@DynamoDBHashKey(attributeName = "Tid")
public int getTid() {
return Tid;
}
public void setTid(int Tid) {
this.Tid = Tid;
}
@DynamoDBAttribute(attributeName = "Mandag")
public String getMandag() {
return Mandag;
}
public void setMandag(String Mandag) {
this.Mandag = Mandag;
}
}
Aucun commentaire:
Enregistrer un commentaire