/*
 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

/*
 * $Id: TCKConverter.java 62525 2011-04-15 12:14:31Z dougd $
 */

package com.sun.ts.tests.jsf.api.javax_faces.component.common;

import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
import javax.faces.context.FacesContext;
import javax.faces.component.UIComponent;


public class TCKConverter implements Converter {

    public Object getAsObject(FacesContext context,
                              UIComponent component,
                              String value) {
        if ("fail".equals(value))
            throw new ConverterException();
        else
            return "converted";
    }


    public String getAsString(FacesContext context, UIComponent component, Object value) {
        return value.toString();
    }
}
