package eja.converters;
import eja.ejb.entities.Hotel;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
/**
*
* @author fero
*/
public class HotelConverter implements Converter {
@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
int id = Integer.parseInt(value);
Hotel hotel = new Hotel();
hotel.setId(id);
return hotel;
}
@Override
public String getAsString(FacesContext context, UIComponent component, Object value) {
Hotel hotel = (Hotel) value;
return hotel.getId().toString();
}
}