You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2008/06/18 04:03:17 UTC
svn commit: r669049 - in
/myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF:
./ facelets-taglib.vm faces-config12.vm tagValidatorClass12.vm
tomahawk12.vm validatorClass12.vm
Author: lu4242
Date: Tue Jun 17 19:03:17 2008
New Revision: 669049
URL: http://svn.apache.org/viewvc?rev=669049&view=rev
Log:
Add missing templates
Added:
myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/
myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/facelets-taglib.vm
myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/faces-config12.vm
myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/tagValidatorClass12.vm
myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/tomahawk12.vm
myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/validatorClass12.vm
Added: myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/facelets-taglib.vm
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/facelets-taglib.vm?rev=669049&view=auto
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/facelets-taglib.vm (added)
+++ myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/facelets-taglib.vm Tue Jun 17 19:03:17 2008
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * 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.
+-->
+<!DOCTYPE facelet-taglib
+ PUBLIC "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN" "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
+<facelet-taglib xmlns="http://java.sun.com/JSF/Facelet">
+
+ <namespace>$uri</namespace>
+
+ <!-- Component Tags -->
+#set ($componentList = ${model.getComponents()})
+#foreach( $component in $componentList )
+#if ($modelIds.contains($component.modelId)
+ && ($component.name))
+#if (!$component.isConfigExcluded())
+ <tag>
+ <tag-name>$utils.getTagName($component.name)</tag-name>
+ <component>
+ <component-type>$component.type</component-type>
+#if ($component.rendererType)
+#if (!($component.rendererType == ""))
+ <renderer-type>$component.rendererType</renderer-type>
+#end
+#end
+#if ($component.tagHandler)
+ <handler-class>$component.tagHandler</handler-class>
+#end
+ </component>
+ </tag>
+#end
+#end
+#end
+
+ <!-- Converter tags -->
+#set ($componentList = ${model.getConverters()})
+#foreach( $component in $componentList )
+#if ($modelIds.contains($component.modelId)
+ && ($component.name))
+#if ($component.converterId)
+ <tag>
+ <tag-name>$utils.getTagName($component.name)</tag-name>
+ <converter>
+ <converter-id>$component.converterId</converter-id>
+ </converter>
+ </tag>
+#end
+#end
+#end
+
+ <!-- Validator tags -->
+#set ($componentList = ${model.getValidators()})
+#foreach( $component in $componentList )
+#if ($modelIds.contains($component.modelId)
+ && ($component.name))
+#if ($component.validatorId)
+ <tag>
+ <tag-name>$utils.getTagName($component.name)</tag-name>
+ <validator>
+ <validator-id>$component.validatorId</validator-id>
+ </validator>
+ </tag>
+#end
+#end
+#end
+
+ <!-- Single Tags -->
+#set ($tagList = $model.getTags())
+#foreach( $tag in $tagList )
+#if ($modelIds.contains($tag.modelId))
+#if ($tag.tagHandler)
+ <tag>
+ <tag-name>$utils.getTagName($tag.name)</tag-name>
+ <handler-class>$tag.tagHandler</handler-class>
+ </tag>
+#end
+#end
+#end
+
+</facelet-taglib>
\ No newline at end of file
Added: myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/faces-config12.vm
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/faces-config12.vm?rev=669049&view=auto
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/faces-config12.vm (added)
+++ myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/faces-config12.vm Tue Jun 17 19:03:17 2008
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ * 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.
+-->
+
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
+ version="1.2">
+
+$baseContent
+
+#set ($componentList = ${model.getComponents()})
+#foreach( $component in $componentList )
+#if ($modelIds.contains($component.modelId)
+ && !($component.className.contains("UIComponent"))
+ && !($component.isConfigExcluded()))
+ <component>
+ <component-type>$component.type</component-type>
+ <component-class>$component.className</component-class>
+ </component>
+#end
+#end
+#set ($converterList = ${model.getConverters()})
+#foreach( $converter in $converterList )
+#if ($modelIds.contains($converter.modelId))
+ <converter>
+ <converter-id>$converter.converterId</converter-id>
+ <converter-class>$converter.className</converter-class>
+ </converter>
+#end
+#end
+#set ($validatorList = ${model.getValidators()})
+#foreach( $validator in $validatorList )
+#if ($modelIds.contains($validator.modelId) &&
+ !($validator.isConfigExcluded().booleanValue()) &&
+ $validator.validatorId)
+ <validator>
+ <validator-id>$validator.validatorId</validator-id>
+ <validator-class>$validator.className</validator-class>
+ </validator>
+#end
+#end
+#set ($renderKitList = ${model.getRenderKits()})
+#foreach( $renderKit in $renderKitList )
+ <render-kit>
+ <render-kit-id>$renderKit.renderKitId</render-kit-id>
+#if ($renderKit.className)
+ <render-kit-class>$renderKit.className</render-kit-class>
+#end
+#set ($rendererList = ${renderKit.getRenderers()})
+#foreach( $renderer in $rendererList )
+ <renderer>
+ <component-family>$renderer.componentFamily</component-family>
+ <renderer-type>$renderer.rendererType</renderer-type>
+ <renderer-class>$renderer.className</renderer-class>
+ </renderer>
+#end
+ </render-kit>
+#end
+</faces-config>
Added: myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/tagValidatorClass12.vm
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/tagValidatorClass12.vm?rev=669049&view=auto
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/tagValidatorClass12.vm (added)
+++ myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/tagValidatorClass12.vm Tue Jun 17 19:03:17 2008
@@ -0,0 +1,158 @@
+// 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 $utils.getPackageFromFullClass($validator.tagClass);
+
+import javax.faces.context.FacesContext;
+import javax.el.ValueExpression;
+import javax.faces.validator.Validator;
+import javax.faces.application.Application;
+import javax.servlet.jsp.JspException;
+$utils.importTagClasses($validator)
+
+public class $utils.getClassFromFullClass($validator.tagClass)
+#if (${validator.tagSuperclass})
+ extends ${validator.tagSuperclass}
+#else
+ extends javax.faces.webapp.ValidatorELTag;
+#end
+{
+#if ($validator.serialuidtag)
+ private static final long serialVersionUID = ${validator.serialuidtag};
+#end
+
+ public $utils.getClassFromFullClass($validator.tagClass)()
+ {
+ }
+#set ($propertyList = ${validator.propertyTagList})
+#foreach( $property in $propertyList )
+#set ($field = $property.fieldName)
+#set ($type = $utils.getJspPropertyType12($property))
+
+ private $type $field;
+
+#set ($var = $utils.getVariableFromName($property.name))
+ public void $utils.getPrefixedPropertyName("set", $property.jspName)($type $var)
+ {
+ $field = $var;
+ }
+#end
+
+ protected Validator createValidator() throws JspException {
+ String validatorId = "$validator.validatorId";
+ Application appl = FacesContext.getCurrentInstance().getApplication();
+ Validator validator = (Validator)appl.createValidator(validatorId);
+ _setProperties(validator);
+ return validator;
+ }
+
+ protected void _setProperties(Validator val) throws JspException {
+ super._setProperties(val);
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ $validator.className validator = ($validator.className) val;
+#foreach( $property in $propertyList )
+#set ($field = $property.fieldName)
+#set ($type = $utils.getJspPropertyType12($property))
+#set ($className = $utils.getPrimitiveType($property.className))
+ if ($field != null)
+ {
+#if ($property.isLiteralOnly())
+#if ($utils.isPrimitiveClass($property.className))
+ validator.${utils.getPrefixedPropertyName("set",$property.name)}(${utils.getBoxedClass($className)}.valueOf($field).${property.className}Value());
+#elseif ($utils.isPrimitiveClass($className))
+ validator.${utils.getPrefixedPropertyName("set",$property.name)}(${utils.getBoxedClass($className)}.valueOf($field));
+#else
+ validator.${utils.getPrefixedPropertyName("set",$property.name)}($field);
+#end
+#else
+ if (!${field}.isLiteralText())
+ {
+ validator.setValueExpression("$property.name", $field);
+ }
+ else
+ {
+#if ($utils.isPrimitiveClass($property.className))
+ Object ${field}Value = ${field}.getValue(facesContext.getELContext());
+ if (${field}Value != null){
+ if (${field}Value instanceof ${utils.getBoxedClass($className)}){
+ validator.${utils.getPrefixedPropertyName("set",$property.name)}(
+ ((${utils.getBoxedClass($className)})${field}Value).${property.className}Value());
+ }
+ else
+ {
+ validator.${utils.getPrefixedPropertyName("set",$property.name)}(
+ ${utils.getBoxedClass($className)}.valueOf(${field}Value.toString()).${property.className}Value());
+ }
+ }
+#elseif ($utils.isPrimitiveClass($className))
+ Object ${field}Value = ${field}.getValue(facesContext.getELContext());
+ if (${field}Value != null){
+ if (${field}Value instanceof ${utils.getBoxedClass($className)}){
+ validator.${utils.getPrefixedPropertyName("set",$property.name)}(
+ ((${utils.getBoxedClass($className)})${field}Value));
+ }
+ else
+ {
+ validator.${utils.getPrefixedPropertyName("set",$property.name)}(
+ ${utils.getBoxedClass($className)}.valueOf(${field}Value.toString()));
+ }
+ }
+#elseif ($utils.getClassFromFullClass($property.className) == "String")
+ Object ${field}Value = ${field}.getValue(facesContext.getELContext());
+ if (${field}Value != null)
+ {
+ validator.${utils.getPrefixedPropertyName("set",$property.name)}(
+ ($property.className) ${field}Value.toString());
+ }
+#elseif ($property.className == "java.lang.String[]")
+ try
+ {
+ String[] value = org.apache.myfaces.commons.util.TagUtils.getStringArray(${field}.getValue(facesContext.getELContext()));
+ validator.${utils.getPrefixedPropertyName("set",$property.name)}(value);
+ }
+ catch (java.text.ParseException pe)
+ {
+ throw new JspException(
+ pe.getMessage() + ": " + "Position " + pe.getErrorOffset());
+ }
+#else
+ validator.${utils.getPrefixedPropertyName("set",$property.name)}(($property.className) ${field}.getValue(facesContext.getELContext()));
+#end
+ }
+#end
+ }
+#end
+ }
+
+ public void release()
+ {
+ super.release();
+#foreach( $property in $propertyList )
+#set ($field = $property.fieldName)
+#if($utils.getJspPropertyType12($property) == "boolean")
+#set ($empty = "false")
+#else
+#set ($empty = "null")
+#end
+ $field = $empty;
+#end
+ }
+}
Added: myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/tomahawk12.vm
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/tomahawk12.vm?rev=669049&view=auto
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/tomahawk12.vm (added)
+++ myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/tomahawk12.vm Tue Jun 17 19:03:17 2008
@@ -0,0 +1,225 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * 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.
+-->
+<taglib xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
+ version="2.1">
+ <tlib-version>1.1.7</tlib-version>
+ <short-name>$shortname</short-name>
+ <uri>$uri</uri>
+ <display-name>$displayname</display-name>
+ <description>$description</description>
+
+$baseContent
+
+ <!-- Component Tags -->
+#set ($componentList = ${model.getComponents()})
+#foreach( $component in $componentList )
+#if ($modelIds.contains($component.modelId)
+ && ($component.name))
+#if ($utils.getTagPrefix($component.name) == $shortname)
+ <tag>
+ <name>$utils.getTagName($component.name)</name>
+ <tag-class>$component.tagClass</tag-class>
+#if ($component.bodyContent)
+ <body-content>$component.bodyContent</body-content>
+#else
+ <body-content>JSP</body-content>
+#end
+ <description><![CDATA[$component.longDescription]]></description>
+
+#set ($propertyList = ${component.propertyList})
+#foreach( $property in $propertyList )
+#if (!$property.isTagExcluded())
+ <attribute>
+ <name>$property.jspName</name>
+#if ($property.isRequired())
+ <required>$property.isRequired()</required>
+#end
+#if ($property.isMethodExpression() || $property.isMethodBinding())
+#if ($property.getMethodBindingSignature())
+ <deferred-method>
+#set ($sig = $property.getMethodBindingSignature())
+ <method-signature>$sig.returnType myMethod( $sig.parameterTypesAsString )</method-signature>
+
+ </deferred-method>
+#else
+## This is a very special case. If a property is MethodBinding or MethodExpression
+## this should have a signature. If not, for allow multiple MethodBinding
+## simulate a ValueExpression and write a custom code like in
+## org.apache.myfaces.custom.suggestajax.AbstractSuggestAjaxTag
+ <deferred-value/>
+#end
+#elseif ($property.isLiteralOnly())
+ <rtexprvalue>false</rtexprvalue>
+#else
+#set ($type = $utils.getClassFromFullClass($property.className))
+#if ($type == "String")
+ <deferred-value></deferred-value>
+#else
+ <deferred-value>
+ <type>$property.className</type>
+ </deferred-value>
+#end
+#end
+#if ($property.longDescription)
+ <description><![CDATA[$property.longDescription]]></description>
+#else
+ <description><![CDATA[]]></description>
+#end
+ </attribute>
+#end
+#end
+ </tag>
+#end
+#end
+#end
+ <!-- Converter tags -->
+#set ($componentList = ${model.getConverters()})
+#foreach( $component in $componentList )
+#if ($modelIds.contains($component.modelId)
+ && ($component.name))
+#if ($utils.getTagPrefix($component.name) == $shortname)
+ <tag>
+ <name>$utils.getTagName($component.name)</name>
+ <tag-class>$component.tagClass</tag-class>
+#if ($component.bodyContent)
+ <body-content>$component.bodyContent</body-content>
+#else
+ <body-content>empty</body-content>
+#end
+ <description><![CDATA[$component.longDescription]]></description>
+
+#set ($propertyList = ${component.propertyList})
+#foreach( $property in $propertyList )
+#if (!$property.isTagExcluded())
+ <attribute>
+ <name>$property.name</name>
+#if ($property.isRequired())
+ <required>$property.isRequired()</required>
+#end
+#if ($property.isLiteralOnly())
+ <rtexprvalue>false</rtexprvalue>
+#else
+#set ($type = $utils.getClassFromFullClass($property.className))
+#if ($type == "String")
+ <deferred-value></deferred-value>
+#else
+ <deferred-value>
+ <type>$property.className</type>
+ </deferred-value>
+#end
+#end
+#if ($property.longDescription)
+ <description><![CDATA[$property.longDescription]]></description>
+#else
+ <description><![CDATA[]]></description>
+#end
+ </attribute>
+#end
+#end
+ </tag>
+#end
+#end
+#end
+ <!-- Validator tags -->
+#set ($componentList = ${model.getValidators()})
+#foreach( $component in $componentList )
+#if ($modelIds.contains($component.modelId)
+ && ($component.name))
+#if ($utils.getTagPrefix($component.name) == $shortname)
+ <tag>
+ <name>$utils.getTagName($component.name)</name>
+ <tag-class>$component.tagClass</tag-class>
+#if ($component.bodyContent)
+ <body-content>$component.bodyContent</body-content>
+#else
+ <body-content>empty</body-content>
+#end
+ <description><![CDATA[$component.longDescription]]></description>
+
+#set ($propertyList = ${component.propertyList})
+#foreach( $property in $propertyList )
+#if (!$property.isTagExcluded())
+ <attribute>
+ <name>$property.name</name>
+#if ($property.isRequired())
+ <required>$property.isRequired()</required>
+#end
+#if ($property.isLiteralOnly())
+ <rtexprvalue>false</rtexprvalue>
+#else
+#set ($type = $utils.getClassFromFullClass($property.className))
+#if ($type == "String")
+ <deferred-value></deferred-value>
+#else
+ <deferred-value>
+ <type>$property.className</type>
+ </deferred-value>
+#end
+#end
+#if ($property.longDescription)
+ <description><![CDATA[$property.longDescription]]></description>
+#else
+ <description><![CDATA[]]></description>
+#end
+ </attribute>
+#end
+#end
+ </tag>
+#end
+#end
+#end
+ <!-- Single Tags -->
+#set ($tagList = $model.getTags())
+#foreach( $tag in $tagList )
+#if ($modelIds.contains($tag.modelId))
+ <tag>
+ <name>$utils.getTagName($tag.name)</name>
+ <tag-class>$tag.className</tag-class>
+ <body-content>$tag.bodyContent</body-content>
+ <description><![CDATA[$tag.longDescription]]></description>
+#set ($attributeList = ${tag.attributeList})
+#foreach( $attribute in $attributeList )
+ <attribute>
+ <name>$attribute.name</name>
+ <required>$attribute.isRequired()</required>
+#set ($type = $utils.getClassFromFullClass($attribute.className))
+#if ($type == "ValueExpression")
+ <deferred-value></deferred-value>
+#else
+ <rtexprvalue>$attribute.isRtexprvalue()</rtexprvalue>
+#if ($attribute.className)
+ <type>$attribute.className</type>
+#else
+ <type>java.lang.String</type>
+#end
+#end
+#if ($property.longDescription)
+ <description><![CDATA[$property.longDescription]]></description>
+#else
+ <description><![CDATA[]]></description>
+#end
+ </attribute>
+#end
+ </tag>
+#end
+#end
+</taglib>
Added: myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/validatorClass12.vm
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/validatorClass12.vm?rev=669049&view=auto
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/validatorClass12.vm (added)
+++ myfaces/commons/trunk/myfaces-commons-validators/src/main/resources/META-INF/validatorClass12.vm Tue Jun 17 19:03:17 2008
@@ -0,0 +1,212 @@
+## Velocity template used to generate JSF1.1-compatible validator classes
+## from validator meta-data.
+##
+## Note that there are only one type of validator generation:
+## * "subclass mode" (use annotated class as a parent class)
+##
+## Variable $validator refers to a ComponentMeta object to process
+## Variable $utils refers to an instance of MyfacesUtils.
+##
+## When "template mode" is being used then variable $innersource
+## holds a String containing all the non-abstract functions defined
+## in the annotated class.
+##
+## The java package of the generated class is always the same as
+## the package in which the annotated class exists.
+##
+/*
+ * 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 ${validator.packageName};
+
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+$utils.importTagClasses($validator)
+
+// generated from class $validator.classSource
+// WARNING: This file was automatically generated. Do not edit it directly,
+// or you will lose your changes.
+public class ${utils.getClassFromFullClass($validator.className)} extends $validator.superClassName
+#if ($validator.implements)
+ implements $validator.implements
+#end
+{
+
+#if ($validator.validatorId)
+ static public final String VALIDATOR_ID =
+ "$validator.validatorId";
+#end
+
+ public ${utils.getClassFromFullClass($validator.className)}()
+ {
+ }
+
+#set ($propertyList = ${validator.propertyValidatorList})
+
+#foreach( $property in $propertyList )
+#set ($field = $property.fieldName)
+#set ($type = $utils.getClassFromFullClass($property.className))
+#if($utils.getDefaultValueField($property))
+#set ($defaultValue = $utils.getDefaultValueField($property))
+#else
+#set ($defaultValue = false)
+#end
+ // Property: $property.name
+#if ($property.isLiteralOnly() || $property.isTagExcluded() )
+ private $type $field #if($defaultValue) = $defaultValue;#{else};#{end}
+
+
+#else
+ private $type $field;
+
+#end
+#if($utils.isPrimitiveClass($type) && !$property.isTagExcluded() )
+ private boolean ${field}Set;
+
+#if ($property.isSetMethod())
+ $property.setMethodScope boolean $utils.getPrefixedPropertyName("isSet", $property.name)()
+ {
+ return ${field}Set;
+ }
+#end
+#end
+#if($property.isLocalMethod())
+#if("boolean" == $type)
+#set ($methodName = $utils.getPrefixedPropertyName("isLocal", $property.name))
+#else
+#set ($methodName = $utils.getPrefixedPropertyName("getLocal", $property.name))
+#end
+ final $property.localMethodScope $type ${methodName}()
+ {
+ return $field;
+ }
+
+#end
+ public $type $utils.getMethodReaderFromProperty($property.name, $type)()
+ {
+#if ($property.isTagExcluded() || $property.isLiteralOnly())
+ return $field;
+#else
+#if ($utils.isPrimitiveClass($type))
+ if (${field}Set)
+#else
+ if ($field != null)
+#end
+ {
+ return $field;
+ }
+ ValueExpression vb = getValueExpression("$property.name");
+ if (vb != null)
+ {
+#if ($utils.isPrimitiveClass($type))
+ return ($utils.castIfNecessary($type) vb.getValue(getFacesContext().getELContext())).${type}Value();
+#else
+#set ($pritype = $utils.getPrimitiveType($property.className))
+#if ($utils.isPrimitiveClass($pritype))
+ Object value = vb == null ? null : vb.getValue(getFacesContext().getELContext());
+ if (!(value instanceof $type)){
+ value = ${type}.valueOf(value.toString());
+ }
+ return $utils.castIfNecessary($type) value;
+#else
+ return $utils.castIfNecessary($type) vb.getValue(getFacesContext().getELContext());
+#end
+#end
+ }
+#if ($defaultValue)
+ return $defaultValue;
+#elseif ($utils.isPrimitiveClass($type))
+ return $utils.primitiveDefaultValue($type);
+#else
+ return null;
+#end
+#end
+ }
+
+ public void $utils.getPrefixedPropertyName("set", $property.name)($type $utils.getVariableFromName($property.name))
+ {
+ this.$field = $utils.getVariableFromName($property.name);
+#if ($utils.isPrimitiveClass($type) && !$property.isTagExcluded() )
+ this.${field}Set = true;
+#end
+ }
+#end
+
+ public Object saveState(FacesContext facesContext)
+ {
+#set ($primitiveCount = $propertyList.size() + 1)
+#foreach( $property in $propertyList )
+#if($utils.isPrimitiveClass($property.className))
+#set ($primitiveCount = $primitiveCount + 1)
+#end
+#end
+ Object[] values = new Object[$primitiveCount];
+ values[0] = super.saveState(facesContext);
+#set ($arrayIndex = 0)
+#foreach( $property in $propertyList )
+#set ($field = $property.fieldName)
+#set ($type = $property.className)
+#set ($arrayIndex = $arrayIndex + 1)
+#if ($property.jspName == "validator" && $property.isMethodBinding() )
+ values[$arrayIndex] = saveAttachedState(facesContext,${field}List);
+#elseif ( $property.isStateHolder() )## || $utils.isConverter($type)
+ values[$arrayIndex] = saveAttachedState(facesContext,$field);
+#elseif($utils.isPrimitiveClass($type))
+ values[$arrayIndex] = ${utils.getBoxedClass($type)}.valueOf($field);
+#else
+ values[$arrayIndex] = $field;
+#end
+#if($utils.isPrimitiveClass($type) && !$property.isTagExcluded())
+#set ($arrayIndex = $arrayIndex + 1)
+ values[$arrayIndex] = Boolean.valueOf(${field}Set);
+#end
+#end
+ return values;
+ }
+
+ public void restoreState(FacesContext facesContext, Object state)
+ {
+ Object[] values = (Object[])state;
+ super.restoreState(facesContext,values[0]);
+#set ($arrayIndex = 0)
+#foreach( $property in $propertyList )
+#set ($field = $property.fieldName)
+#set ($type = $property.className)
+#set ($arrayIndex = $arrayIndex + 1)
+#if ( $property.isStateHolder() )
+#if ($property.jspName == "validator" && $property.isMethodBinding() )
+ ${field}List = (List<Validator>) restoreAttachedState(facesContext,values[$arrayIndex]);
+#elseif ($utils.isList($type))
+ $field = (List) restoreAttachedState(facesContext,values[$arrayIndex]);
+#else
+ $field = $utils.castIfNecessary($type) restoreAttachedState(facesContext,values[$arrayIndex]);
+#end
+#elseif ($utils.isConverter($type))
+ $field = (Converter) restoreAttachedState(facesContext,values[$arrayIndex]);
+#elseif ($utils.isPrimitiveClass($type))
+ $field = ($utils.castIfNecessary($type) values[$arrayIndex]).${type}Value();
+#else
+ $field = $utils.castIfNecessary($type) values[$arrayIndex];
+#end
+#if($utils.isPrimitiveClass($type) && !$property.isTagExcluded() )
+#set ($arrayIndex = $arrayIndex + 1)
+ ${field}Set = ((Boolean) values[$arrayIndex]).booleanValue();
+#end
+#end
+ }
+}