sclass DefaultValueConverterForField implements ValueConverterForField { public OrError convertValue(O object, Field field, O value) { Class actualType = field.getType(); Class type = primitiveToBoxedTypeOpt(actualType); // nothing to do if (isInstance(type, value)) ret OrError(value); // int magic if (type == Int.class && !value instanceof Int) ret OrError(toInt(trimIfString(value)); // double magic if (type == Double.class && !value instanceof Double) ret OrError(toDouble(trimIfString(value)); // bool magic if (type == Bool.class && value instanceof S) if (actualType == Bool.class && eq(value, "")) ret OrError(null); else ret OrError(eqicOneOf((S) value, "1", "true", "yes")); // GlobalID magic ifclass GlobalID if (type == GlobalID.class && value instanceof S) ret OrError(GlobalID((S) value)); endif ret OrError(value); } }