如何在具有特定对象列表的编辑器中实现 GWT ValueListBox,我的代码:
...
@UiField(provided = true)
@Path("address.countryCode")
ValueListBox<Country> countries = new ValueListBox<Country>(
new Renderer<Country>() {
@Override
public String render(Country object) {
return object.getCountryName();
}
@Override
public void render(Country object, Appendable appendable)
throws IOException {
render(object);
}
},
new ProvidesKey<Country>() {
@Override
public Object getKey(Country item) {
return item.getCountryCode();
}
});
...
国家级
public class Country {
private String countryName;
private String countryCode;
}
但是,在 GWT 编译期间,我收到了这个错误:
Type mismatch: cannot convert from String to Country