// This is a hack to get the combo box working even though
// PetType does not implement equals/hashCode.
private class PetTypeAdapter extends TypeConverter {
private PetTypeAdapter(ValueModel valueModel, final Map petTypes) {
super(valueModel, new Closure() {
public Object call(Object petType) {
return petType != null ? ((PetType)petType).getName() : "";
}
}, new Closure() {
public Object call(Object petTypeName) {
return petTypes.get(petTypeName);
}
});
}