if (value == null) {
value = ""; // TODO should we allow null for non-primitive types?
} else if (toType.isAssignableFrom(value.getClass())) {
return value;
} else if (toType.equals(float.class) || toType.equals(Float.class)) {
<BUG>return new Float(getFloat(value));
</BUG>
} else if (toType.equals(double.class) || toType.equals(Double.class)) {
<BUG>return new Double(getDouble(value));
</BUG>
} else if (toType.equals(String.class)) {

if (value == null) {
value = ""; // TODO should we allow null for non-primitive types?
} else if (toType.isAssignableFrom(value.getClass())) {
return value;
} else if (toType.equals(float.class) || toType.equals(Float.class)) {
return Float.valueOf(getFloat(value));
} else if (toType.equals(double.class) || toType.equals(Double.class)) {
return Double.valueOf(getDouble(value));
} else if (toType.equals(String.class)) {
