return keyVal;
}
public static String getItemNameFromKey(Class<?> clazz, Object key){
Field idField = ClassInfo.getIdField(clazz);
Id id = idField.getAnnotation(Id.class);
String keyVal = null;
if(id != null){
switch(id.value()) {
case NONE:
{
keyVal = toString(idField, key);
break;
}
case AUTO_INCREMENT:
// manages String ID as not long!!!
throw new SienaRestrictedApiException("DB", "getItemName", "@Id AUTO_INCREMENT not supported by SDB");
case UUID:
{
keyVal = toString(idField, key);
break;
}
default:
throw new SienaRestrictedApiException("DB", "createEntityInstance", "Id Generator "+id.value()+ " not supported");
}
}
else throw new SienaException("Field " + idField.getName() + " is not an @Id field");
return keyVal;