// WARNING: This file was automatically generated. Do not edit it directly,
//          or you will lose your changes.
/*
 *  Licensed to the Apache Software Foundation (ASF) under one
 *  or more contributor license agreements.  See the NOTICE file
 *  distributed with this work for additional information
 *  regarding copyright ownership.  The ASF licenses this file
 *  to you under the Apache License, Version 2.0 (the
 *  "License"); you may not use this file except in compliance
 *  with the License.  You may obtain a copy of the License at
 * 
 *  http://www.apache.org/licenses/LICENSE-2.0
 * 
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *  KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations
 *  under the License.
 */
package org.apache.myfaces.custom.creditcardvalidator;

import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
import javax.faces.validator.Validator;
import javax.faces.webapp.UIComponentTag;
import javax.servlet.jsp.JspException;


// Generated from class org.apache.myfaces.custom.creditcardvalidator.AbstractCreditCardValidator.
//
// WARNING: This file was automatically generated. Do not edit it directly,
//          or you will lose your changes.
public class ValidateCreditCardTag
    extends org.apache.myfaces.validator.ValidatorBaseTag
{
    private static final long serialVersionUID = 3810660506302799072L; 

    public ValidateCreditCardTag()
    {    
    }    
 
    private String _amex;
    
    public void setAmex(String amex)
    {
        _amex = amex;
    }
 
    private String _discover;
    
    public void setDiscover(String discover)
    {
        _discover = discover;
    }
 
    private String _mastercard;
    
    public void setMastercard(String mastercard)
    {
        _mastercard = mastercard;
    }
 
    private String _none;
    
    public void setNone(String none)
    {
        _none = none;
    }
 
    private String _visa;
    
    public void setVisa(String visa)
    {
        _visa = visa;
    }

    protected Validator createValidator() throws JspException {
    
        FacesContext facesContext = FacesContext.getCurrentInstance();
        setValidatorId("org.apache.myfaces.validator.CreditCard");    
        org.apache.myfaces.custom.creditcardvalidator.CreditCardValidator validator = (org.apache.myfaces.custom.creditcardvalidator.CreditCardValidator)super.createValidator();
        if (_amex != null)
        {
            if (UIComponentTag.isValueReference(_amex))
            {
                ValueBinding vb = facesContext.getApplication().createValueBinding(_amex);
                validator.setAmex(Boolean.valueOf(vb.getValue(facesContext).toString()).booleanValue());
            }
            else
            {
                validator.setAmex(Boolean.valueOf(_amex).booleanValue());
            }
        }
        if (_discover != null)
        {
            if (UIComponentTag.isValueReference(_discover))
            {
                ValueBinding vb = facesContext.getApplication().createValueBinding(_discover);
                validator.setDiscover(Boolean.valueOf(vb.getValue(facesContext).toString()).booleanValue());
            }
            else
            {
                validator.setDiscover(Boolean.valueOf(_discover).booleanValue());
            }
        }
        if (_mastercard != null)
        {
            if (UIComponentTag.isValueReference(_mastercard))
            {
                ValueBinding vb = facesContext.getApplication().createValueBinding(_mastercard);
                validator.setMastercard(Boolean.valueOf(vb.getValue(facesContext).toString()).booleanValue());
            }
            else
            {
                validator.setMastercard(Boolean.valueOf(_mastercard).booleanValue());
            }
        }
        if (_none != null)
        {
            if (UIComponentTag.isValueReference(_none))
            {
                ValueBinding vb = facesContext.getApplication().createValueBinding(_none);
                validator.setNone(Boolean.valueOf(vb.getValue(facesContext).toString()).booleanValue());
            }
            else
            {
                validator.setNone(Boolean.valueOf(_none).booleanValue());
            }
        }
        if (_visa != null)
        {
            if (UIComponentTag.isValueReference(_visa))
            {
                ValueBinding vb = facesContext.getApplication().createValueBinding(_visa);
                validator.setVisa(Boolean.valueOf(vb.getValue(facesContext).toString()).booleanValue());
            }
            else
            {
                validator.setVisa(Boolean.valueOf(_visa).booleanValue());
            }
        }
        return validator;
    }

    public void release()
    {
        super.release();
        _amex = null;
        _discover = null;
        _mastercard = null;
        _none = null;
        _visa = null;
    }
}
