Package eja.converters

Source Code of eja.converters.HotelConverter

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();
    }

}
TOP

Related Classes of eja.converters.HotelConverter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.