* @param pKeySchemaThe key schema for a specific table
* @param pIdenNumber of spaces used for indentation
* @throws IOException
*/
private void setKeyMethods(KeySchema pKeySchema, int pIden) throws IOException{
KeySchemaElement hashKey = pKeySchema.getHashKeyElement();
KeySchemaElement rangeKey = pKeySchema.getRangeKeyElement();
StringBuilder strBuilder = new StringBuilder();
// hash key
if(hashKey != null){
strBuilder.append("@DynamoDBHashKey(attributeName=\"" + hashKey.getAttributeName() + "\") \n");
strBuilder.append(" public String getHashKey() { return " + hashKey.getAttributeName() + "; } \n");
strBuilder.append(" public void setHashKey(" + (hashKey.getAttributeType().equals("S")?"String ":"double "));
strBuilder.append("p" + camelCasify(hashKey.getAttributeName()) + "){ this." + hashKey.getAttributeName());
strBuilder.append(" = p" + camelCasify(hashKey.getAttributeName()) + "; }");
line(pIden, strBuilder.toString());
}
strBuilder.delete(0, strBuilder.length());
// range key
if(rangeKey != null){
strBuilder.append("@DynamoDBRangeKey(attributeName=\"" + rangeKey.getAttributeName() + "\") \n");
strBuilder.append(" public String getRangeKey() { return " + rangeKey.getAttributeName() + "; } \n");
strBuilder.append(" public void setRangeKey(" + (rangeKey.getAttributeType().equals("S")?"String ":"double "));
strBuilder.append("p" + camelCasify(rangeKey.getAttributeName()) + "){ this." + rangeKey.getAttributeName());
strBuilder.append(" = p" + camelCasify(rangeKey.getAttributeName()) + "; }");
line(pIden, strBuilder.toString());
}
line(0, "");
}