/**
 * GENERATED FILE - DO NOT EDIT
 *
 */
package ${tag.packageName};

#foreach($import in $imports)
import $import ;
#end
import javax.faces.component.UIComponent;
import javax.faces.validator.Validator;
import org.apache.commons.beanutils.ConvertUtils;
import javax.faces.context.FacesContext;
import javax.servlet.jsp.JspException;
import javax.el.ValueExpression;
import ${validator.classname};

public class $tag.simpleClassName extends $tag.superclass {


#tagPropertyMethods12($validator)

  protected Validator createValidator() throws JspException
  {
    ${validator.simpleClassName} validator = (${validator.simpleClassName}) FacesContext.getCurrentInstance().getApplication().createValidator("${validator.id}");
    _setProperties(validator);
    return validator;
  }

  // Support method to wire in properties
  private void _setProperties(${validator.simpleClassName} validator) throws JspException 
  {
    FacesContext facesContext = FacesContext.getCurrentInstance();
#foreach( $prop in $validator.properties )
#if( !$prop.existintag )
    if (_${prop.name} != null) 
    {
#if( ${prop.el} )
      if (_${prop.name} instanceof ValueExpression) 
      {
        validator.${prop.setterName}((${prop.simpleClassName}) _${prop.name}.getValue(facesContext.getELContext()));
      }
#if (${prop.elonly})
      if(null != this._${prop.name} && this._${prop.name}.isLiteralText())
      {
	    throw new IllegalArgumentException("Validator ${validator.name} allows only EL expressions for property ${prop.name}");
	  }
#end
    }
#else
    validator.${prop.setterName}((${prop.simpleClassName}) ConvertUtils.convert(_${prop.name}, ${prop.simpleClassName}.class));
#end
#end
#end
  }
}
