Public feed
#893292
public class CountryConverter implements Converter, Serializable {
Map<String, Country> map;
public CountryConverter(List<Country> list) {
map = new HashMap<String, Country>();
for (Country c : list) {
map.put(c.getIso(), c);
}
}
public Object getAsObject(FacesContext context, UIComponent component, String value) {
return map.get(value);
}
public String getAsString(FacesContext context, UIComponent component, Object value) {
if (value instanceof Country) {
return ((Country) value).getIso();
} else {
return null;
}
}
}