The HTML table just has strings
Primitive data types (double, boolean, etc.) are converted automatically
Other types require toString()
methods for output or parse()
methods for input.
toString()
is standard. parse()
method in the fixture class looks like this:
public Object parse(String s, Class type) throws Exception {
if (type.equals(CustomClass.class)) {
return parseCustomClass(s);
}
else return super.parse(s, type);
}
private static Object parseCustomClass(String s) {
// code to convert
}
You can invoke any method in the model class, the fixture class, or some other class to convert the String
to the object as convenient. Here I've just made it a static method in the fixture class.