Instead of if/then over the set of types, each enum value can implement its own setter. this will clean up CloudTableRest.java, and take advantage of the fact that the type is already known, and can have it's own polymorphic implementation to set the value…here's an example for TYPE_DOUBLE
TYPE_DOUBLE("Edm.Double", "real"){
@Override
public void applyValue(String value, Field f, Object target) throws NumberFormatException, IllegalArgumentException, IllegalAccessException {
f.setDouble(target, Double.parseDouble(value));
}
},
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Instead of if/then over the set of types, each enum value can implement its own setter. this will clean up CloudTableRest.java, and take advantage of the fact that the type is already known, and can have it's own polymorphic implementation to set the value…here's an example for TYPE_DOUBLE
TYPE_DOUBLE("Edm.Double", "real"){
@Override
public void applyValue(String value, Field f, Object target) throws NumberFormatException, IllegalArgumentException, IllegalAccessException {
f.setDouble(target, Double.parseDouble(value));
}
},