You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by ma...@apache.org on 2009/12/27 19:01:09 UTC

svn commit: r894087 [23/46] - in /struts/xwork/trunk: ./ assembly/ assembly/src/ assembly/src/main/ assembly/src/main/assembly/ assembly/src/main/resources/ core/ core/src/ core/src/main/ core/src/main/java/ core/src/main/java/com/ core/src/main/java/c...

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/FieldExpressionValidator.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/FieldExpressionValidator.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/FieldExpressionValidator.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/FieldExpressionValidator.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+
+package com.opensymphony.xwork2.validator.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <!-- START SNIPPET: description -->
+ * This validator uses an OGNL expression to perform its validator.
+ * The error message will be added to the field if the expression returns
+ * false when it is evaluated against the value stack.
+ * <!-- END SNIPPET: description -->
+ *
+ * <p/> <u>Annotation usage:</u>
+ *
+ * <!-- START SNIPPET: usage -->
+ * <p/>The annotation must be applied at method level.
+ * <!-- END SNIPPET: usage -->
+ *
+ * <p/> <u>Annotation parameters:</u>
+ *
+ * <!-- START SNIPPET: parameters -->
+ * <table class='confluenceTable'>
+ * <tr>
+ * <th class='confluenceTh'> Parameter </th>
+ * <th class='confluenceTh'> Required </th>
+ * <th class='confluenceTh'> Default </th>
+ * <th class='confluenceTh'> Notes </th>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>message</td>
+ * <td class='confluenceTd'>yes</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>field error message</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>key</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>fieldName</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>shortCircuit</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>false</td>
+ * <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> expression </td>
+ * <td class='confluenceTd'> yes </td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'> An OGNL expression that returns a boolean value.  </td>
+ * </tr>
+ * </table>
+ * <!-- END SNIPPET: parameters -->
+ *
+ * <p/> <u>Example code:</u>
+ *
+ * <pre>
+ * <!-- START SNIPPET: example -->
+ * &#64;FieldExpressionValidator(message = "Default message", key = "i18n.key", shortCircuit = true, expression = "an OGNL expression")
+ * <!-- END SNIPPET: example -->
+ * </pre>
+ *
+ * @author Rainer Hermanns
+ * @version $Id$
+ */
+@Target({ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface FieldExpressionValidator {
+
+    /**
+     *  An OGNL expression that returns a boolean value.
+     */
+    String expression();
+
+    /**
+     * The default error message for this validator.
+     * NOTE: It is required to set a message, if you are not using the message key for 18n lookup!
+     */
+    String message() default "";
+
+    /**
+     * The message key to lookup for i18n.
+     */
+    String key() default "";
+
+    /**
+     * The optional fieldName for SIMPLE validator types.
+     */
+    String fieldName() default "";
+
+    /**
+     * If this is activated, the validator will be used as short-circuit.
+     *
+     * Adds the short-circuit="true" attribute value if <tt>true</tt>.
+     *
+     */
+    boolean shortCircuit() default false;
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/FieldExpressionValidator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/FieldExpressionValidator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/IntRangeFieldValidator.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/IntRangeFieldValidator.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/IntRangeFieldValidator.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/IntRangeFieldValidator.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+
+package com.opensymphony.xwork2.validator.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <!-- START SNIPPET: description -->
+ * This validator checks that a numeric field has a value within a specified range.
+ * If neither min nor max is set, nothing will be done.
+ * <!-- END SNIPPET: description -->
+ *
+ * <p/> <u>Annotation usage:</u>
+ *
+ * <!-- START SNIPPET: usage -->
+ * <p/>The annotation must be applied at method level.
+ * <!-- END SNIPPET: usage -->
+ *
+ * <p/> <u>Annotation parameters:</u>
+ *
+ * <!-- START SNIPPET: parameters -->
+ * <table class='confluenceTable'>
+ * <tr>
+ * <th class='confluenceTh'> Parameter </th>
+ * <th class='confluenceTh'> Required </th>
+ * <th class='confluenceTh'> Default </th>
+ * <th class='confluenceTh'> Notes </th>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>message</td>
+ * <td class='confluenceTd'>yes</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>field error message</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>key</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>fieldName</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>shortCircuit</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>false</td>
+ * <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>type</td>
+ * <td class='confluenceTd'>yes</td>
+ * <td class='confluenceTd'>ValidatorType.FIELD</td>
+ * <td class='confluenceTd'>Enum value from ValidatorType. Either FIELD or SIMPLE can be used here.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> min </td>
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'> Integer property.  The minimum the number must be. </td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> max </td>
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'> Integer property.  The maximum number can be. </td>
+ * </tr>
+ * </table>
+ *
+ * <p>If neither <em>min</em> nor <em>max</em> is set, nothing will be done.</p>
+ *
+ * <p>The values for min and max must be inserted as String values so that "0" can be handled as a possible value.</p>
+ * <!-- END SNIPPET: parameters -->
+ *
+ * <p/> <u>Example code:</u>
+ *
+ * <pre>
+ * <!-- START SNIPPET: example -->
+ * &#64;IntRangeFieldValidator(message = "Default message", key = "i18n.key", shortCircuit = true, min = "0", max = "42")
+ * <!-- END SNIPPET: example -->
+ * </pre>
+ *
+ *
+ * @author Rainer Hermanns
+ * @version $Id$
+ */
+@Target({ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface IntRangeFieldValidator {
+
+    /**
+     *  Integer property. The minimum the number must be.
+     */
+    String min() default "";
+
+    /**
+     *  Integer property. The maximum number can be.
+     */
+    String max() default "";
+
+    /**
+     * The default error message for this validator.
+     * NOTE: It is required to set a message, if you are not using the message key for 18n lookup!
+     */
+    String message() default "";
+
+    /**
+     * The message key to lookup for i18n.
+     */
+    String key() default "";
+
+    /**
+     * The optional fieldName for SIMPLE validator types.
+     */
+    String fieldName() default "";
+
+    /**
+     * If this is activated, the validator will be used as short-circuit.
+     *
+     * Adds the short-circuit="true" attribute value if <tt>true</tt>.
+     *
+     */
+    boolean shortCircuit() default false;
+
+    /**
+     * The validation type for this field/method.
+     */
+    ValidatorType type() default ValidatorType.FIELD;
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/IntRangeFieldValidator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/IntRangeFieldValidator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RegexFieldValidator.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RegexFieldValidator.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RegexFieldValidator.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RegexFieldValidator.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+
+package com.opensymphony.xwork2.validator.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <!-- START SNIPPET: description -->
+ * Validates a string field using a regular expression.
+ * <!-- END SNIPPET: description -->
+ *
+ * <p/> <u>Annotation usage:</u>
+ *
+ * <!-- START SNIPPET: usage -->
+ * <p/>The annotation must be applied at method level.
+ * <!-- END SNIPPET: usage -->
+ *
+ * <p/> <u>Annotation parameters:</u>
+ *
+ * <!-- START SNIPPET: parameters -->
+ * <table class='confluenceTable'>
+ * <tr>
+ * <th class='confluenceTh'> Parameter </th>
+ * <th class='confluenceTh'> Required </th>
+ * <th class='confluenceTh'> Default </th>
+ * <th class='confluenceTh'> Notes </th>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>message</td>
+ * <td class='confluenceTd'>yes</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>field error message</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>key</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>fieldName</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>shortCircuit</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>false</td>
+ * <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>type</td>
+ * <td class='confluenceTd'>yes</td>
+ * <td class='confluenceTd'>ValidatorType.FIELD</td>
+ * <td class='confluenceTd'>Enum value from ValidatorType. Either FIELD or SIMPLE can be used here.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>expression</td>
+ * <td class='confluenceTd'>yes</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>The regex to validate the field value against.</td>
+ * </tr>
+ * </table>
+ * <!-- END SNIPPET: parameters -->
+ *
+ * <p/> <u>Example code:</u>
+ *
+ * <pre>
+ * <!-- START SNIPPET: example -->
+ * &#64;RegexFieldValidator( key = "regex.field", expression = "yourregexp")
+ * <!-- END SNIPPET: example -->
+ * </pre>
+ *
+ * @author <a href="mailto:hermanns@aixcept.de">Rainer Hermanns</a>
+ * @version $Id$
+ */
+@Target({ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface RegexFieldValidator {
+
+    /**
+     * The default error message for this validator.
+     * NOTE: It is required to set a message, if you are not using the message key for 18n lookup!
+     */
+    String message() default "";
+
+    /**
+     * The message key to lookup for i18n.
+     */
+    String key() default "";
+
+    /**
+     * The optional fieldName for SIMPLE validator types.
+     */
+    String fieldName() default "";
+
+
+    String expression();
+
+    /**
+     * If this is activated, the validator will be used as short-circuit.
+     *
+     * Adds the short-circuit="true" attribute value if <tt>true</tt>.
+     *
+     */
+    boolean shortCircuit() default false;
+
+    /**
+     * The validation type for this field/method.
+     */
+    ValidatorType type() default ValidatorType.FIELD;
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RegexFieldValidator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RegexFieldValidator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredFieldValidator.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredFieldValidator.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredFieldValidator.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredFieldValidator.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+
+package com.opensymphony.xwork2.validator.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <!-- START SNIPPET: description -->
+ * This validator checks that a field is non-null.
+ * <!-- END SNIPPET: description -->
+ *
+ * <p/> <u>Annotation usage:</u>
+ *
+ * <!-- START SNIPPET: usage -->
+ * <p/>The annotation must be applied at method level.
+ * <!-- END SNIPPET: usage -->
+ *
+ * <p/> <u>Annotation parameters:</u>
+ *
+ * <!-- START SNIPPET: parameters -->
+ * <table class='confluenceTable'>
+ * <tr>
+ * <th class='confluenceTh'> Parameter </th>
+ * <th class='confluenceTh'> Required </th>
+ * <th class='confluenceTh'> Default </th>
+ * <th class='confluenceTh'> Notes </th>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>message</td>
+ * <td class='confluenceTd'>yes</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>field error message</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>key</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>fieldName</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>shortCircuit</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>false</td>
+ * <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>type</td>
+ * <td class='confluenceTd'>yes</td>
+ * <td class='confluenceTd'>ValidatorType.FIELD</td>
+ * <td class='confluenceTd'>Enum value from ValidatorType. Either FIELD or SIMPLE can be used here.</td>
+ * </tr>
+ * </table>
+ * <!-- END SNIPPET: parameters -->
+ *
+ * <p/> <u>Example code:</u>
+ *
+ * <pre>
+ * <!-- START SNIPPET: example -->
+ * &#64;RequiredFieldValidator(message = "Default message", key = "i18n.key", shortCircuit = true)
+ * <!-- END SNIPPET: example -->
+ * </pre>
+ *
+ *
+ * @author Rainer Hermanns
+ * @version $Id$
+ */
+@Target({ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface RequiredFieldValidator {
+
+    /**
+     * The default error message for this validator.
+     * NOTE: It is required to set a message, if you are not using the message key for 18n lookup!
+     */
+    String message() default "";
+
+    /**
+     * The message key to lookup for i18n.
+     */
+    String key() default "";
+
+    /**
+     * The optional fieldName for SIMPLE validator types.
+     */
+    String fieldName() default "";
+
+    /**
+     * If this is activated, the validator will be used as short-circuit.
+     *
+     * Adds the short-circuit="true" attribute value if <tt>true</tt>.
+     *
+     */
+    boolean shortCircuit() default false;
+
+    /**
+     * The validation type for this field/method.
+     */
+    ValidatorType type() default ValidatorType.FIELD;
+
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredFieldValidator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredFieldValidator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredStringValidator.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredStringValidator.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredStringValidator.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredStringValidator.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+
+package com.opensymphony.xwork2.validator.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <!-- START SNIPPET: description -->
+ * This validator checks that a String field is not empty (i.e. non-null with a length > 0).
+ * <!-- END SNIPPET: description -->
+ *
+ * <p/> <u>Annotation usage:</u>
+ *
+ * <!-- START SNIPPET: usage -->
+ * <p/>The annotation must be applied at method level.
+ * <!-- END SNIPPET: usage -->
+ *
+ * <p/> <u>Annotation parameters:</u>
+ *
+ * <!-- START SNIPPET: parameters -->
+ * <table class='confluenceTable'>
+ * <tr>
+ * <th class='confluenceTh'> Parameter </th>
+ * <th class='confluenceTh'> Required </th>
+ * <th class='confluenceTh'> Default </th>
+ * <th class='confluenceTh'> Notes </th>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>message</td>
+ * <td class='confluenceTd'>yes</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>field error message</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>key</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>fieldName</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>shortCircuit</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>false</td>
+ * <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>type</td>
+ * <td class='confluenceTd'>yes</td>
+ * <td class='confluenceTd'>ValidatorType.FIELD</td>
+ * <td class='confluenceTd'>Enum value from ValidatorType. Either FIELD or SIMPLE can be used here.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> trim </td>
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'> true </td>
+ * <td class='confluenceTd'> Boolean property.  Determines whether the String is trimmed before performing the length check.  </td>
+ * </tr>
+ * </table>
+ * <!-- END SNIPPET: parameters -->
+ *
+ * <p/> <u>Example code:</u>
+ *
+ * <pre>
+ * <!-- START SNIPPET: example -->
+ * &#64;RequiredStringValidator(message = "Default message", key = "i18n.key", shortCircuit = true, trim = true)
+ * <!-- END SNIPPET: example -->
+ * </pre>
+ *
+ *
+ * @author Rainer Hermanns
+ * @version $Id$
+ */
+@Target({ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface RequiredStringValidator {
+
+    /**
+     *  Boolean property. Determines whether the String is trimmed before performing the length check.
+     */
+    boolean trim() default true;
+
+    /**
+     * The default error message for this validator.
+     * NOTE: It is required to set a message, if you are not using the message key for 18n lookup!
+     */
+    String message() default "";
+
+    /**
+     * The message key to lookup for i18n.
+     */
+    String key() default "";
+
+    /**
+     * The optional fieldName for SIMPLE validator types.
+     */
+    String fieldName() default "";
+
+    /**
+     * If this is activated, the validator will be used as short-circuit.
+     *
+     * Adds the short-circuit="true" attribute value if <tt>true</tt>.
+     *
+     */
+    boolean shortCircuit() default false;
+
+    /**
+     * The validation type for this field/method.
+     */
+    ValidatorType type() default ValidatorType.FIELD;
+
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredStringValidator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredStringValidator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/StringLengthFieldValidator.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/StringLengthFieldValidator.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/StringLengthFieldValidator.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/StringLengthFieldValidator.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+
+package com.opensymphony.xwork2.validator.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <!-- START SNIPPET: description -->
+ * This validator checks that a String field is of the right length. It assumes that the field is a String.
+ * If neither minLength nor maxLength is set, nothing will be done.
+ * <!-- END SNIPPET: description -->
+ *
+ * <p/> <u>Annotation usage:</u>
+ *
+ * <!-- START SNIPPET: usage -->
+ * <p/>The annotation must be applied at method level.
+ * <!-- END SNIPPET: usage -->
+ *
+ * <p/> <u>Annotation parameters:</u>
+ *
+ * <!-- START SNIPPET: parameters -->
+ * <table class='confluenceTable'>
+ * <tr>
+ * <th class='confluenceTh'> Parameter </th>
+ * <th class='confluenceTh'> Required </th>
+ * <th class='confluenceTh'> Default </th>
+ * <th class='confluenceTh'> Notes </th>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>message</td>
+ * <td class='confluenceTd'>yes</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>field error message</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>key</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>fieldName</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>shortCircuit</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>false</td>
+ * <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>type</td>
+ * <td class='confluenceTd'>yes</td>
+ * <td class='confluenceTd'>ValidatorType.FIELD</td>
+ * <td class='confluenceTd'>Enum value from ValidatorType. Either FIELD or SIMPLE can be used here.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> trim </td>
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'> true </td>
+ * <td class='confluenceTd'> Boolean property.  Determines whether the String is trimmed before performing the length check.  </td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> minLength </td>
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'> Integer property.  The minimum length the String must be. </td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> maxLength </td>
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'> Integer property.  The maximum length the String can be. </td>
+ * </tr>
+ * </table>
+ *
+ * <p>If neither <em>minLength</em> nor <em>maxLength</em> is set, nothing will be done.</p>
+ *
+ * <!-- END SNIPPET: parameters -->
+ *
+ * <p/> <u>Example code:</u>
+ *
+ * <pre>
+ * <!-- START SNIPPET: example -->
+ * &#64;StringLengthFieldValidator(message = "Default message", key = "i18n.key", shortCircuit = true, trim = true, minLength = "5",  maxLength = "12")
+ * <!-- END SNIPPET: example -->
+ * </pre>
+ *
+ * @author Rainer Hermanns
+ * @version $Id$
+ */
+@Target({ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface StringLengthFieldValidator {
+
+    /**
+     *  Boolean property. Determines whether the String is trimmed before performing the length check.
+     */
+    boolean trim() default true;
+
+    /**
+     *  Integer property. The minimum length the String must be.
+     */
+    String minLength() default "";
+
+    /**
+     *  Integer property. The maximum length the String can be.
+     */
+    String maxLength() default "";
+
+    /**
+     * The default error message for this validator.
+     * NOTE: It is required to set a message, if you are not using the message key for 18n lookup!
+     */
+    String message() default "";
+
+    /**
+     * The message key to lookup for i18n.
+     */
+    String key() default "";
+
+    /**
+     * The optional fieldName for SIMPLE validator types.
+     */
+    String fieldName() default "";
+
+    /**
+     * If this is activated, the validator will be used as short-circuit.
+     *
+     * Adds the short-circuit="true" attribute value if <tt>true</tt>.
+     *
+     */
+    boolean shortCircuit() default false;
+
+    /**
+     * The validation type for this field/method.
+     */
+    ValidatorType[] type() default {ValidatorType.FIELD};
+
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/StringLengthFieldValidator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/StringLengthFieldValidator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/UrlValidator.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/UrlValidator.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/UrlValidator.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/UrlValidator.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+
+package com.opensymphony.xwork2.validator.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <!-- START SNIPPET: description -->
+ * This validator checks that a field is a valid URL.
+ * <!-- END SNIPPET: description -->
+ *
+ * <p/> <u>Annotation usage:</u>
+ *
+ * <!-- START SNIPPET: usage -->
+ * <p/>The annotation must be applied at method level.
+ * <!-- END SNIPPET: usage -->
+ *
+ * <p/> <u>Annotation parameters:</u>
+ *
+ * <!-- START SNIPPET: parameters -->
+ * <table class='confluenceTable'>
+ * <tr>
+ * <th class='confluenceTh'> Parameter </th>
+ * <th class='confluenceTh'> Required </th>
+ * <th class='confluenceTh'> Default </th>
+ * <th class='confluenceTh'> Notes </th>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>message</td>
+ * <td class='confluenceTd'>yes</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>field error message</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>key</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>fieldName</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>shortCircuit</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>false</td>
+ * <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>type</td>
+ * <td class='confluenceTd'>yes</td>
+ * <td class='confluenceTd'>ValidatorType.FIELD</td>
+ * <td class='confluenceTd'>Enum value from ValidatorType. Either FIELD or SIMPLE can be used here.</td>
+ * </tr>
+ * </table>
+ * <!-- END SNIPPET: parameters -->
+ *
+ * <p/> <u>Example code:</u>
+ *
+ * <pre>
+ * <!-- START SNIPPET: example -->
+ * &#64;UrlValidator(message = "Default message", key = "i18n.key", shortCircuit = true)
+ * <!-- END SNIPPET: example -->
+ * </pre>
+ *
+ * @author Rainer Hermanns
+ * @version $Id$
+ */
+@Target({ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface UrlValidator {
+
+    /**
+     * The default error message for this validator.
+     * NOTE: It is required to set a message, if you are not using the message key for 18n lookup!
+     */
+    String message() default "";
+
+    /**
+     * The message key to lookup for i18n.
+     */
+    String key() default "";
+
+    /**
+     * The optional fieldName for SIMPLE validator types.
+     */
+    String fieldName() default "";
+
+    /**
+     * If this is activated, the validator will be used as short-circuit.
+     *
+     * Adds the short-circuit="true" attribute value if <tt>true</tt>.
+     *
+     */
+    boolean shortCircuit() default false;
+
+    /**
+     * The validation type for this field/method.
+     */
+    ValidatorType type() default ValidatorType.FIELD;
+
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/UrlValidator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/UrlValidator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validation.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validation.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validation.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validation.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+
+package com.opensymphony.xwork2.validator.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <!-- START SNIPPET: description -->
+ * This annotation has been deprecated since 2.1 as its previous purpose, to define classes that support annotation validations,
+ * is no longer necessary.
+ * <!-- END SNIPPET: description -->
+ *
+ * <p/> <u>Annotation usage:</u>
+ *
+ * <!-- START SNIPPET: usage -->
+ *  <p/>The Validation annotation must be applied at Type level.
+ * <!-- END SNIPPET: usage -->
+ *
+ * <p/> <u>Annotation parameters:</u>
+ *
+ * <!-- START SNIPPET: parameters -->
+ * <table class='confluenceTable'>
+ * <tr>
+ * <th class='confluenceTh'> Parameter </th>
+ * <th class='confluenceTh'> Required </th>
+ * <th class='confluenceTh'> Default </th>
+ * <th class='confluenceTh'> Notes </th>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>validations</td>
+ * <td class='confluenceTd'>yes</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'></td>
+ * </tr>
+ * </table>
+ * <!-- END SNIPPET: parameters -->
+ *
+ * <p/> <u>Example code:</u>
+ *
+ * <u>An Annotated Interface</u>
+ * <pre>
+ * <!-- START SNIPPET: example -->
+ * &#64;Validation()
+ * public interface AnnotationDataAware {
+ *
+ *     void setBarObj(Bar b);
+ *
+ *     Bar getBarObj();
+ *
+ *     &#64;RequiredFieldValidator(message = "You must enter a value for data.")
+ *     &#64;RequiredStringValidator(message = "You must enter a value for data.")
+ *     void setData(String data);
+ *
+ *     String getData();
+ * }
+ * <!-- END SNIPPET: example -->
+ * </pre>
+ *
+ * <p/> <u>Example code:</u>
+ *
+ * <u>An Annotated Class</u>
+ * <pre>
+ * <!-- START SNIPPET: example2 -->
+ * &#64;Validation()
+ * public class SimpleAnnotationAction extends ActionSupport {
+ *
+ *     &#64;RequiredFieldValidator(type = ValidatorType.FIELD, message = "You must enter a value for bar.")
+ *     &#64;IntRangeFieldValidator(type = ValidatorType.FIELD, min = "6", max = "10", message = "bar must be between ${min} and ${max}, current value is ${bar}.")
+ *     public void setBar(int bar) {
+ *         this.bar = bar;
+ *     }
+ *
+ *     public int getBar() {
+ *         return bar;
+ *     }
+ *
+ *     &#64;Validations(
+ *             requiredFields =
+ *                     {&#64;RequiredFieldValidator(type = ValidatorType.SIMPLE, fieldName = "customfield", message = "You must enter a value for field.")},
+ *             requiredStrings =
+ *                     {&#64;RequiredStringValidator(type = ValidatorType.SIMPLE, fieldName = "stringisrequired", message = "You must enter a value for string.")},
+ *             emails =
+ *                     { &#64;EmailValidator(type = ValidatorType.SIMPLE, fieldName = "emailaddress", message = "You must enter a value for email.")},
+ *             urls =
+ *                     { &#64;UrlValidator(type = ValidatorType.SIMPLE, fieldName = "hreflocation", message = "You must enter a value for email.")},
+ *             stringLengthFields =
+ *                     {&#64;StringLengthFieldValidator(type = ValidatorType.SIMPLE, trim = true, minLength="10" , maxLength = "12", fieldName = "needstringlength", message = "You must enter a stringlength.")},
+ *             intRangeFields =
+ *                     { @IntRangeFieldValidator(type = ValidatorType.SIMPLE, fieldName = "intfield", min = "6", max = "10", message = "bar must be between ${min} and ${max}, current value is ${bar}.")},
+ *             dateRangeFields =
+ *                     {&#64;DateRangeFieldValidator(type = ValidatorType.SIMPLE, fieldName = "datefield", min = "-1", max = "99", message = "bar must be between ${min} and ${max}, current value is ${bar}.")},
+ *             expressions = {
+ *                 &#64;ExpressionValidator(expression = "foo &gt; 1", message = "Foo must be greater than Bar 1. Foo = ${foo}, Bar = ${bar}."),
+ *                 &#64;ExpressionValidator(expression = "foo &gt; 2", message = "Foo must be greater than Bar 2. Foo = ${foo}, Bar = ${bar}."),
+ *                 &#64;ExpressionValidator(expression = "foo &gt; 3", message = "Foo must be greater than Bar 3. Foo = ${foo}, Bar = ${bar}."),
+ *                 &#64;ExpressionValidator(expression = "foo &gt; 4", message = "Foo must be greater than Bar 4. Foo = ${foo}, Bar = ${bar}."),
+ *                 &#64;ExpressionValidator(expression = "foo &gt; 5", message = "Foo must be greater than Bar 5. Foo = ${foo}, Bar = ${bar}.")
+ *     }
+ *     )
+ *     public String execute() throws Exception {
+ *         return SUCCESS;
+ *     }
+ * }
+ *
+ * <!-- END SNIPPET: example2 -->
+ * </pre>
+ *
+ * @author Rainer Hermanns
+ * @deprecated Since Struts 2.1 because it isn't necessary anymore
+ * @version $Id$
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Validation {
+
+    /**
+     * Used for class or interface validation rules.
+     */
+    Validations[] validations() default {};
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validation.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ValidationParameter.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ValidationParameter.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ValidationParameter.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ValidationParameter.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+
+package com.opensymphony.xwork2.validator.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <!-- START SNIPPET: description -->
+ * The ValidationParameter annotation is used as a parameter for CustomValidators.
+ * <!-- END SNIPPET: description -->
+ *
+ * <p/> <u>Annotation usage:</u>
+ *
+ * <!-- START SNIPPET: usage -->
+ * <p/>The annotation must embedded into CustomValidator annotations as a parameter.
+ * <!-- END SNIPPET: usage -->
+ *
+ * <p/> <u>Annotation parameters:</u>
+ *
+ * <!-- START SNIPPET: parameters -->
+ * <table class='confluenceTable'>
+ * <tr>
+ * <th class='confluenceTh'> Parameter </th>
+ * <th class='confluenceTh'> Required </th>
+ * <th class='confluenceTh'> Default </th>
+ * <th class='confluenceTh'> Notes </th>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>name</td>
+ * <td class='confluenceTd'>yes</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>parameter name.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>value</td>
+ * <td class='confluenceTd'>yes</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>parameter value.</td>
+ * </tr>
+ * </table>
+ * <!-- END SNIPPET: parameters -->
+ *
+ * <p/> <u>Example code:</u>
+ *
+ * <pre>
+ * <!-- START SNIPPET: example -->
+ * &#64;CustomValidator(
+ *   type ="customValidatorName",
+ *   fieldName = "myField",
+ *   parameters = { &#64;ValidationParameter( name = "paramName", value = "paramValue" ) }
+ * )
+ * <!-- END SNIPPET: example -->
+ * </pre>
+ *
+ * @author jepjep
+ * @author Rainer Hermanns
+ */
+@Target( { ElementType.METHOD, ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ValidationParameter {
+
+	String name();
+
+	String value();
+
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ValidationParameter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ValidationParameter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validations.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validations.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validations.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validations.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+
+package com.opensymphony.xwork2.validator.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <!-- START SNIPPET: description -->
+ * <p>If you want to use several annotations of the same type, these annotations must be nested within the @Validations() annotation.</p>
+ * <!-- END SNIPPET: description -->
+ *
+ * <p/> <u>Annotation usage:</u>
+ *
+ * <!-- START SNIPPET: usage -->
+ * <p/>Used at METHOD level.
+ * <!-- END SNIPPET: usage -->
+ *
+ * <p/> <u>Annotation parameters:</u>
+ *
+ * <!-- START SNIPPET: parameters -->
+ * <table class='confluenceTable'>
+ *
+ * <tr>
+ * <th class='confluenceTh'> Parameter </th>
+ * <th class='confluenceTh'> Required </th>
+ * <th class='confluenceTh'> Notes </th>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> requiredFields </td>
+ * <td class='confluenceTd'> no </td>
+ *
+ * <td class='confluenceTd'> Add list of RequiredFieldValidators  </td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> customValidators </td>
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'> Add list of CustomValidators </td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> conversionErrorFields </td>
+ *
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'> Add list of ConversionErrorFieldValidators </td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> dateRangeFields </td>
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'> Add list of DateRangeFieldValidators </td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> emails </td>
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'> Add list of EmailValidators </td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> fieldExpressions </td>
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'> Add list of FieldExpressionValidators </td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> intRangeFields </td>
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'> Add list of IntRangeFieldValidators </td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> requiredStrings </td>
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'> Add list of RequiredStringValidators </td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> stringLengthFields </td>
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'> Add list of StringLengthFieldValidators </td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> urls </td>
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'> Add list of UrlValidators </td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> visitorFields </td>
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'> Add list of VisitorFieldValidators </td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> regexFields </td>
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'> Add list of RegexFieldValidator </td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> expressions </td>
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'> Add list of ExpressionValidator </td>
+ * </tr>
+ * </table>
+ * <!-- END SNIPPET: parameters -->
+ *
+ * <p/> <u>Example code:</u>
+ *
+ * <pre>
+ * <!-- START SNIPPET: example -->
+ * &#64;Validations(
+ *           requiredFields =
+ *                   {&#64;RequiredFieldValidator(type = ValidatorType.SIMPLE, fieldName = "customfield", message = "You must enter a value for field.")},
+ *           requiredStrings =
+ *                   {&#64;RequiredStringValidator(type = ValidatorType.SIMPLE, fieldName = "stringisrequired", message = "You must enter a value for string.")},
+ *           emails =
+ *                   { &#64;EmailValidator(type = ValidatorType.SIMPLE, fieldName = "emailaddress", message = "You must enter a value for email.")},
+ *           urls =
+ *                   { &#64;UrlValidator(type = ValidatorType.SIMPLE, fieldName = "hreflocation", message = "You must enter a value for email.")},
+ *           stringLengthFields =
+ *                   {&#64;StringLengthFieldValidator(type = ValidatorType.SIMPLE, trim = true, minLength="10" , maxLength = "12", fieldName = "needstringlength", message = "You must enter a stringlength.")},
+ *           intRangeFields =
+ *                   { &#64;IntRangeFieldValidator(type = ValidatorType.SIMPLE, fieldName = "intfield", min = "6", max = "10", message = "bar must be between ${min} and ${max}, current value is ${bar}.")},
+ *           dateRangeFields =
+ *                   {&#64;DateRangeFieldValidator(type = ValidatorType.SIMPLE, fieldName = "datefield", min = "-1", max = "99", message = "bar must be between ${min} and ${max}, current value is ${bar}.")},
+ *           expressions = {
+ *               &#64;ExpressionValidator(expression = "foo &gt; 1", message = "Foo must be greater than Bar 1. Foo = ${foo}, Bar = ${bar}."),
+ *               &#64;ExpressionValidator(expression = "foo &gt; 2", message = "Foo must be greater than Bar 2. Foo = ${foo}, Bar = ${bar}."),
+ *               &#64;ExpressionValidator(expression = "foo &gt; 3", message = "Foo must be greater than Bar 3. Foo = ${foo}, Bar = ${bar}."),
+ *               &#64;ExpressionValidator(expression = "foo &gt; 4", message = "Foo must be greater than Bar 4. Foo = ${foo}, Bar = ${bar}."),
+ *               &#64;ExpressionValidator(expression = "foo &gt; 5", message = "Foo must be greater than Bar 5. Foo = ${foo}, Bar = ${bar}.")
+ *   }
+ *   )
+ *   public String execute() throws Exception {
+ *       return SUCCESS;
+ *   }
+ * <!-- END SNIPPET: example -->
+ * </pre>
+ *
+ * @author jepjep
+ * @author Rainer Hermanns
+ * @version $Id$
+ */
+@Target( { ElementType.METHOD, ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Validations {
+
+    /**
+     * Custom Validation rules.
+     */
+    public CustomValidator[] customValidators() default {};
+
+    public ConversionErrorFieldValidator[] conversionErrorFields() default {};
+
+    public DateRangeFieldValidator[] dateRangeFields() default {};
+
+    public EmailValidator[] emails() default {};
+
+    public FieldExpressionValidator[] fieldExpressions() default {};
+
+    public IntRangeFieldValidator[] intRangeFields() default {};
+
+    public RequiredFieldValidator[] requiredFields() default {};
+
+    public RequiredStringValidator[] requiredStrings() default {};
+
+    public StringLengthFieldValidator[] stringLengthFields() default {};
+
+    public UrlValidator[] urls() default {};
+    
+    public ConditionalVisitorFieldValidator[] conditionalVisitorFields() default {};
+
+    public VisitorFieldValidator[] visitorFields() default {};
+
+    public RegexFieldValidator[] regexFields() default {};
+
+    public ExpressionValidator[] expressions() default {};
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validations.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validations.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ValidatorType.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ValidatorType.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ValidatorType.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ValidatorType.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+
+package com.opensymphony.xwork2.validator.annotations;
+
+/**
+ * <code>ValidatorType</code>
+ *
+ * @author Rainer Hermanns
+ * @version $Id$
+ */
+public enum ValidatorType {
+
+    FIELD, SIMPLE;
+
+    @Override
+    public String toString() {
+        return super.toString().toUpperCase();
+    }
+    
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ValidatorType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ValidatorType.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/VisitorFieldValidator.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/VisitorFieldValidator.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/VisitorFieldValidator.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/VisitorFieldValidator.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+
+package com.opensymphony.xwork2.validator.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <!-- START SNIPPET: description -->
+ * The validator allows you to forward validator to object properties of your action
+ * using the objects own validator files. This allows you to use the ModelDriven development
+ * pattern and manage your validations for your models in one place, where they belong, next to
+ * your model classes.
+ *
+ * The VisitorFieldValidator can handle either simple Object properties, Collections of Objects, or Arrays.
+ * The error message for the VisitorFieldValidator will be appended in front of validator messages added
+ * by the validations for the Object message.
+ * <!-- END SNIPPET: description -->
+ *
+ * <p/> <u>Annotation usage:</u>
+ *
+ * <!-- START SNIPPET: usage -->
+ * <p/>The annotation must be applied at method level.
+ * <!-- END SNIPPET: usage -->
+ *
+ * <p/> <u>Annotation parameters:</u>
+ *
+ * <!-- START SNIPPET: parameters -->
+ * <table class='confluenceTable'>
+ * <tr>
+ * <th class='confluenceTh'> Parameter </th>
+ * <th class='confluenceTh'> Required </th>
+ * <th class='confluenceTh'> Default </th>
+ * <th class='confluenceTh'> Notes </th>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>message</td>
+ * <td class='confluenceTd'>yes</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>field error message</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>key</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>i18n key from language specific properties file.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>fieldName</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * <td class='confluenceTd'>&nbsp;</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'>shortCircuit</td>
+ * <td class='confluenceTd'>no</td>
+ * <td class='confluenceTd'>false</td>
+ * <td class='confluenceTd'>If this validator should be used as shortCircuit.</td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> context </td>
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'> action alias </td>
+ * <td class='confluenceTd'> Determines the context to use for validating the Object property. If not defined, the context of the Action validation is propogated to the Object property validation.  In the case of Action validation, this context is the Action alias.  </td>
+ * </tr>
+ * <tr>
+ * <td class='confluenceTd'> appendPrefix </td>
+ * <td class='confluenceTd'> no </td>
+ * <td class='confluenceTd'> true </td>
+ * <td class='confluenceTd'> Determines whether the field name of this field validator should be prepended to the field name of the visited field to determine the full field name when an error occurs.  For example, suppose that the bean being validated has a "name" property.  If <em>appendPrefix</em> is true, then the field error will be stored under the field "bean.name".  If <em>appendPrefix</em> is false, then the field error will be stored under the field "name".  <br clear="all" /> <img class="emoticon" src="/images/icons/emoticons/warning.gif" height="16" width="16" align="absmiddle" alt="" border="0"/> If you are using the VisitorFieldValidator to validate the model from a ModelDriven Action, you should set <em>appendPrefix</em> to false unless you are using "model.name" to reference the properties on your model. </td>
+ * </tr>
+ * </table>
+ * <!-- END SNIPPET: parameters -->
+ *
+ * <p/> <u>Example code:</u>
+ *
+ * <pre>
+ * <!-- START SNIPPET: example -->
+ * &#64;VisitorFieldValidator(message = "Default message", key = "i18n.key", shortCircuit = true, context = "action alias", appendPrefix = true)
+ * <!-- END SNIPPET: example -->
+ * </pre>
+ *
+ * @author Rainer Hermanns
+ * @version $Id$
+ */
+@Target({ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface VisitorFieldValidator {
+
+    /**
+     * Determines the context to use for validating the Object property.
+     * If not defined, the context of the Action validator is propogated to the Object property validator.
+     * In the case of Action validator, this context is the Action alias.
+     */
+    String context() default "";
+
+    /**
+     * Determines whether the field name of this field validator should be prepended to the field name of
+     * the visited field to determine the full field name when an error occurs. For example, suppose that
+     * the bean being validated has a "name" property.
+     *
+     * If appendPrefix is true, then the field error will be stored under the field "bean.name".
+     * If appendPrefix is false, then the field error will be stored under the field "name".
+     *
+     * If you are using the VisitorFieldValidator to validate the model from a ModelDriven Action,
+     * you should set appendPrefix to false unless you are using "model.name" to reference the properties
+     * on your model.
+     */
+    boolean appendPrefix() default true;
+
+    /**
+     * The default error message for this validator.
+     * NOTE: It is required to set a message, if you are not using the message key for 18n lookup!
+     */
+    String message() default "";
+
+    /**
+     * The message key to lookup for i18n.
+     */
+    String key() default "";
+
+    /**
+     * The optional fieldName for SIMPLE validator types.
+     */
+    String fieldName() default "";
+
+    /**
+     * If this is activated, the validator will be used as short-circuit.
+     *
+     * Adds the short-circuit="true" attribute value if <tt>true</tt>.
+     *
+     */
+    boolean shortCircuit() default false;
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/VisitorFieldValidator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/VisitorFieldValidator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/package.html
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/package.html?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/package.html (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/package.html Sun Dec 27 18:00:13 2009
@@ -0,0 +1 @@
+<body>Validator annotations.</body>

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/annotations/package.html
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/AbstractFieldValidatorDescription.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/AbstractFieldValidatorDescription.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/AbstractFieldValidatorDescription.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/AbstractFieldValidatorDescription.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.validator.metadata;
+
+import com.opensymphony.xwork2.util.logging.Logger;
+import com.opensymphony.xwork2.util.logging.LoggerFactory;
+
+/**
+ * <code>AbstractFieldValidatorDescription</code>
+ *
+ * @author Rainer Hermanns
+ * @version $Id$
+ */
+public abstract class AbstractFieldValidatorDescription implements ValidatorDescription {
+
+    /**
+     * Jakarta commons-logging reference.
+     */
+    protected static Logger log = null;
+
+    public String fieldName;
+    public String key;
+    public String message;
+    public boolean shortCircuit;
+    public boolean simpleValidator;
+
+
+    public AbstractFieldValidatorDescription() {
+        log = LoggerFactory.getLogger(this.getClass());
+    }
+
+    /**
+     * Creates an AbstractFieldValidatorDescription with the specified field name.
+     *
+     * @param fieldName
+     */
+    public AbstractFieldValidatorDescription(String fieldName) {
+        this.fieldName = fieldName;
+        log = LoggerFactory.getLogger(this.getClass());
+    }
+
+    /**
+     * Sets the field name for this validator rule.
+     *
+     * @return fieldName the field name for this validator rule
+     */
+    public String getFieldName() {
+        return fieldName;
+    }
+
+    /**
+     * Sets the field name for this validator rule.
+     *
+     * @param fieldName the field name for this validator rule
+     */
+    public void setFieldName(String fieldName) {
+        this.fieldName = fieldName;
+    }
+
+    /**
+     * Sets the I18N message key.
+     * @param key the I18N message key
+     */
+    public void setKey(String key) {
+        this.key = key;
+    }
+
+    /**
+     * Sets the default validator failure message.
+     *
+     * @param message the default validator failure message
+     */
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    /**
+     * Set the shortCircuit flag.
+     *
+     * @param shortCircuit the shortCircuit flag.
+     */
+    public void setShortCircuit(boolean shortCircuit) {
+        this.shortCircuit = shortCircuit;
+    }
+
+    public void setSimpleValidator(boolean simpleValidator) {
+        this.simpleValidator = simpleValidator;
+    }
+
+    public boolean isSimpleValidator() {
+        return simpleValidator;
+    }
+
+    /**
+     * Returns the validator XML definition.
+     *
+     * @return the validator XML definition.
+     */
+    public String asXml() {
+        if ( simpleValidator) {
+            return asSimpleXml();
+        }
+        return asFieldXml();
+    }
+
+    /**
+     * Returns the field validator XML definition.
+     *
+     * @return the field validator XML definition.
+     */
+    public abstract String asFieldXml();
+
+     /**
+      * Returns the validator XML definition.
+      *
+      * @return the validator XML definition.
+      */
+     public abstract String asSimpleXml();
+
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/AbstractFieldValidatorDescription.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/AbstractFieldValidatorDescription.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/ConversionErrorFieldValidatorDescription.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/ConversionErrorFieldValidatorDescription.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/ConversionErrorFieldValidatorDescription.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/ConversionErrorFieldValidatorDescription.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.validator.metadata;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+/**
+ * <code>ConversionErrorFieldValidatorDescription</code>
+ *
+ * @author Rainer Hermanns
+ * @version $Id$
+ */
+public class ConversionErrorFieldValidatorDescription extends AbstractFieldValidatorDescription {
+
+    public ConversionErrorFieldValidatorDescription() {
+        super();
+    }
+
+    /**
+     * Creates an AbstractFieldValidatorDescription with the specified field name.
+     *
+     * @param fieldName
+     */
+    public ConversionErrorFieldValidatorDescription(String fieldName) {
+        super(fieldName);
+    }
+
+
+    /**
+     * Returns the field validator XML definition.
+     *
+     * @return the field validator XML definition.
+     */
+    @Override
+    public String asFieldXml() {
+        StringWriter sw = new StringWriter();
+        PrintWriter writer = null;
+
+        try {
+            writer = new PrintWriter(sw);
+
+            if (shortCircuit) {
+                writer.println("\t\t<field-validator type=\"conversion\">");
+            } else {
+                writer.println("\t\t<field-validator type=\"conversion\" short-circuit=\"true\">");
+            }
+
+            if (!"".equals(key)) {
+                writer.println("\t\t\t<message key=\"" + key + "\">" + message + "</message>");
+            } else {
+                writer.println("\t\t\t<message>" + message + "</message>");
+            }
+
+            writer.println("\t\t</field-validator>");
+
+        } finally {
+            if (writer != null) {
+                writer.flush();
+                writer.close();
+            }
+        }
+        return sw.toString();
+
+    }
+
+    /**
+     * Returns the validator XML definition.
+     *
+     * @return the validator XML definition.
+     */
+    @Override
+    public String asSimpleXml() {
+        StringWriter sw = new StringWriter();
+        PrintWriter writer = null;
+
+        try {
+            writer = new PrintWriter(sw);
+
+            if (shortCircuit) {
+                writer.println("\t<validator type=\"conversion\">");
+            } else {
+                writer.println("\t<validator type=\"conversion\" short-circuit=\"true\">");
+            }
+
+            writer.println("\t\t<param name=\"fieldName\">" + fieldName + "</param>");
+
+            if (!"".equals(key)) {
+                writer.println("\t\t<message key=\"" + key + "\">" + message + "</message>");
+            } else {
+                writer.println("\t\t<message>" + message + "</message>");
+            }
+
+            writer.println("\t</validator>");
+
+        } finally {
+            if (writer != null) {
+                writer.flush();
+                writer.close();
+            }
+        }
+        return sw.toString();
+    }
+
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/ConversionErrorFieldValidatorDescription.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/ConversionErrorFieldValidatorDescription.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/DateRangeFieldValidatorDescription.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/DateRangeFieldValidatorDescription.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/DateRangeFieldValidatorDescription.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/DateRangeFieldValidatorDescription.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.validator.metadata;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+/**
+ * <code>DateRangeFieldValidatorDescription</code>
+ *
+ * @author Rainer Hermanns
+ * @version $Id$
+ */
+public class DateRangeFieldValidatorDescription extends AbstractFieldValidatorDescription {
+
+    public String min;
+    public String max;
+
+    public DateRangeFieldValidatorDescription() {
+    }
+
+    /**
+     * Creates an AbstractFieldValidatorDescription with the specified field name.
+     *
+     * @param fieldName
+     */
+    public DateRangeFieldValidatorDescription(String fieldName) {
+        super(fieldName);
+    }
+
+    public void setMin(String min) {
+        this.min = min;
+    }
+
+    public void setMax(String max) {
+        this.max = max;
+    }
+
+ /**
+     * Returns the field validator XML definition.
+     *
+     * @return the field validator XML definition.
+     */
+    @Override
+    public String asFieldXml() {
+        StringWriter sw = new StringWriter();
+        PrintWriter writer = null;
+
+        try {
+            writer = new PrintWriter(sw);
+
+            if ( shortCircuit) {
+                writer.println("\t\t<field-validator type=\"date\">");
+            } else {
+                writer.println("\t\t<field-validator type=\"date\" short-circuit=\"true\">");
+            }
+            if ( min != null && min.length() > 0) {
+                writer.println("\t\t\t<param name=\"min\">" + min + "</param>");
+            }
+            if ( max != null && max.length() > 0) {
+                writer.println("\t\t\t<param name=\"max\">" + max + "</param>");
+            }
+
+            if ( !"".equals(key)) {
+                writer.println("\t\t\t<message key=\"" + key + "\">" + message + "</message>");
+            } else {
+                writer.println("\t\t\t<message>" + message + "</message>");
+            }
+
+            writer.println("\t\t</field-validator>");
+
+        } finally {
+            if (writer != null) {
+                writer.flush();
+                writer.close();
+            }
+        }
+        return sw.toString();
+
+    }
+
+    /**
+     * Returns the validator XML definition.
+     *
+     * @return the validator XML definition.
+     */
+    @Override
+    public String asSimpleXml() {
+        StringWriter sw = new StringWriter();
+        PrintWriter writer = null;
+
+        try {
+            writer = new PrintWriter(sw);
+
+            if ( shortCircuit) {
+                writer.println("\t<validator type=\"date\">");
+            } else {
+                writer.println("\t<validator type=\"date\" short-circuit=\"true\">");
+            }
+
+            writer.println("\t\t<param name=\"fieldName\">" + fieldName+ "</param>");
+
+
+            if ( min != null && min.length() > 0) {
+                writer.println("\t\t<param name=\"min\">" + min + "</param>");
+            }
+            if ( max != null && max.length() > 0) {
+                writer.println("\t\t<param name=\"max\">" + max + "</param>");
+            }
+
+            if ( !"".equals(key)) {
+                writer.println("\t\t<message key=\"" + key + "\">" + message + "</message>");
+            } else {
+                writer.println("\t\t<message>" + message + "</message>");
+            }
+
+            writer.println("\t</validator>");
+
+        } finally {
+            if (writer != null) {
+                writer.flush();
+                writer.close();
+            }
+        }
+        return sw.toString();
+    }
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/DateRangeFieldValidatorDescription.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/DateRangeFieldValidatorDescription.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/DoubleRangeFieldValidatorDescription.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/DoubleRangeFieldValidatorDescription.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/DoubleRangeFieldValidatorDescription.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/DoubleRangeFieldValidatorDescription.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+
+package com.opensymphony.xwork2.validator.metadata;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+/**
+ * <code>DoubleRangeFieldValidatorDescription</code>
+ *
+ * @author <a href="mailto:hermanns@aixcept.de">Rainer Hermanns</a>
+ * @version $Id$
+ */
+public class DoubleRangeFieldValidatorDescription extends AbstractFieldValidatorDescription {
+
+    public String min;
+    public String max;
+
+    public DoubleRangeFieldValidatorDescription() {
+    }
+
+    /**
+     * Creates an DoubleRangeFieldValidatorDescription with the specified field name.
+     *
+     * @param fieldName
+     */
+    public DoubleRangeFieldValidatorDescription(String fieldName) {
+        super(fieldName);
+    }
+
+    public void setMin(String min) {
+        this.min = min;
+    }
+
+    public void setMax(String max) {
+        this.max = max;
+    }
+
+    /**
+     * Returns the field validator XML definition.
+     *
+     * @return the field validator XML definition.
+     */
+    @Override
+    public String asFieldXml() {
+        StringWriter sw = new StringWriter();
+        PrintWriter writer = null;
+
+        try {
+            writer = new PrintWriter(sw);
+
+            if ( shortCircuit) {
+                writer.println("\t\t<field-validator type=\"double\">");
+            } else {
+                writer.println("\t\t<field-validator type=\"double\" short-circuit=\"true\">");
+            }
+            if ( min != null && min.length() > 0) {
+                writer.println("\t\t\t<param name=\"min\">" + min + "</param>");
+            }
+            if ( max != null && max.length() > 0) {
+                writer.println("\t\t\t<param name=\"max\">" + max + "</param>");
+            }
+
+            if ( !"".equals(key)) {
+                writer.println("\t\t\t<message key=\"" + key + "\">" + message + "</message>");
+            } else {
+                writer.println("\t\t\t<message>" + message + "</message>");
+            }
+
+            writer.println("\t\t</field-validator>");
+
+        } finally {
+            if (writer != null) {
+                writer.flush();
+                writer.close();
+            }
+        }
+        return sw.toString();
+
+    }
+
+    /**
+     * Returns the validator XML definition.
+     *
+     * @return the validator XML definition.
+     */
+    @Override
+    public String asSimpleXml() {
+        StringWriter sw = new StringWriter();
+        PrintWriter writer = null;
+
+        try {
+            writer = new PrintWriter(sw);
+
+            if ( shortCircuit) {
+                writer.println("\t<validator type=\"double\">");
+            } else {
+                writer.println("\t<validator type=\"double\" short-circuit=\"true\">");
+            }
+
+            writer.println("\t\t<param name=\"fieldName\">" + fieldName+ "</param>");
+
+
+            if ( min != null && min.length() > 0) {
+                writer.println("\t\t<param name=\"min\">" + min + "</param>");
+            }
+            if ( max != null && max.length() > 0) {
+                writer.println("\t\t<param name=\"max\">" + max + "</param>");
+            }
+
+            if ( !"".equals(key)) {
+                writer.println("\t\t<message key=\"" + key + "\">" + message + "</message>");
+            } else {
+                writer.println("\t\t<message>" + message + "</message>");
+            }
+
+            writer.println("\t</validator>");
+
+        } finally {
+            if (writer != null) {
+                writer.flush();
+                writer.close();
+            }
+        }
+        return sw.toString();
+    }
+
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/DoubleRangeFieldValidatorDescription.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/DoubleRangeFieldValidatorDescription.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/EmailValidatorDescription.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/EmailValidatorDescription.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/EmailValidatorDescription.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/EmailValidatorDescription.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.validator.metadata;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+/**
+ * <code>EmailValidatorDescription</code>
+ *
+ * @author Rainer Hermanns
+ * @version $Id$
+ */
+public class EmailValidatorDescription extends AbstractFieldValidatorDescription {
+
+
+    public EmailValidatorDescription() {
+    }
+
+    /**
+     * Creates an AbstractFieldValidatorDescription with the specified field name.
+     *
+     * @param fieldName
+     */
+    public EmailValidatorDescription(String fieldName) {
+        super(fieldName);
+    }
+
+    /**
+      * Returns the field validator XML definition.
+      *
+      * @return the field validator XML definition.
+      */
+     @Override
+     public String asFieldXml() {
+         StringWriter sw = new StringWriter();
+         PrintWriter writer = null;
+
+         try {
+             writer = new PrintWriter(sw);
+
+             if ( shortCircuit) {
+                 writer.println("\t\t<field-validator type=\"email\">");
+             } else {
+                 writer.println("\t\t<field-validator type=\"email\" short-circuit=\"true\">");
+             }
+
+             if ( !"".equals(key)) {
+                 writer.println("\t\t\t<message key=\"" + key + "\">" + message + "</message>");
+             } else {
+                 writer.println("\t\t\t<message>" + message + "</message>");
+             }
+
+             writer.println("\t\t</field-validator>");
+
+         } finally {
+             if (writer != null) {
+                 writer.flush();
+                 writer.close();
+             }
+         }
+         return sw.toString();
+
+     }
+
+     /**
+      * Returns the validator XML definition.
+      *
+      * @return the validator XML definition.
+      */
+     @Override
+     public String asSimpleXml() {
+         StringWriter sw = new StringWriter();
+         PrintWriter writer = null;
+
+         try {
+             writer = new PrintWriter(sw);
+
+             if ( shortCircuit) {
+                 writer.println("\t<validator type=\"email\">");
+             } else {
+                 writer.println("\t<validator type=\"email\" short-circuit=\"true\">");
+             }
+
+             writer.println("\t\t<param name=\"fieldName\">" + fieldName+ "</param>");
+
+             if ( !"".equals(key)) {
+                 writer.println("\t\t<message key=\"" + key + "\">" + message + "</message>");
+             } else {
+                 writer.println("\t\t<message>" + message + "</message>");
+             }
+
+             writer.println("\t</validator>");
+
+         } finally {
+             if (writer != null) {
+                 writer.flush();
+                 writer.close();
+             }
+         }
+         return sw.toString();
+     }
+
+
+
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/EmailValidatorDescription.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/EmailValidatorDescription.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/ExpressionValidatorDescription.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/ExpressionValidatorDescription.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/ExpressionValidatorDescription.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/ExpressionValidatorDescription.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.validator.metadata;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+/**
+ * <code>ExpressionValidatorDescription</code>
+ *
+ * @author Rainer Hermanns
+ * @version $Id$
+ */
+public class ExpressionValidatorDescription implements ValidatorDescription {
+
+    public String expression;
+    public String key;
+    public String message;
+    public boolean shortCircuit;
+
+    public void setExpression(String expression) {
+        this.expression = expression;
+    }
+
+    public void setKey(String key) {
+        this.key = key;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public void setShortCircuit(boolean shortCircuit) {
+        this.shortCircuit = shortCircuit;
+    }
+
+    /**
+     * Returns the field name to create the validation rule for.
+     *
+     * @return The field name to create the validation rule for
+     */
+    public String getFieldName() {
+        throw new UnsupportedOperationException("ExpressionValidator annotations cannot be applied to fields...");
+    }
+
+    public String asXml() {
+        StringWriter sw = new StringWriter();
+        PrintWriter writer = null;
+
+        try {
+            writer = new PrintWriter(sw);
+
+            if ( shortCircuit) {
+                writer.println("\t<validator type=\"expression\">");
+            } else {
+                writer.println("\t<validator type=\"expression\" short-circuit=\"true\">");
+            }
+
+            writer.println("\t\t<param name=\"expression\">" + expression+ "</param>");
+
+            if ( !"".equals(key)) {
+                writer.println("\t\t<message key=\"" + key + "\">" + message + "</message>");
+            } else {
+                writer.println("\t\t<message>" + message + "</message>");
+            }
+
+            writer.println("\t</validator>");
+
+        } finally {
+            if (writer != null) {
+                writer.flush();
+                writer.close();
+            }
+        }
+        return sw.toString();
+    }
+
+    public boolean isSimpleValidator() {
+        return false;
+    }
+}

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/ExpressionValidatorDescription.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/ExpressionValidatorDescription.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/FieldExpressionValidatorDescription.java
URL: http://svn.apache.org/viewvc/struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/FieldExpressionValidatorDescription.java?rev=894087&view=auto
==============================================================================
--- struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/FieldExpressionValidatorDescription.java (added)
+++ struts/xwork/trunk/core/src/main/java/com/opensymphony/xwork2/validator/metadata/FieldExpressionValidatorDescription.java Sun Dec 27 18:00:13 2009
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork2.validator.metadata;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+/**
+ * <code>FieldExpressionValidatorDescription</code>
+ *
+ * @author Rainer Hermanns
+ * @version $Id$
+ */
+public class FieldExpressionValidatorDescription extends AbstractFieldValidatorDescription {
+
+    public String expression;
+    public String key;
+    public String message;
+    public boolean shortCircuit;
+
+    public FieldExpressionValidatorDescription() {
+    }
+
+    /**
+     * Creates an AbstractFieldValidatorDescription with the specified field name.
+     *
+     * @param fieldName
+     */
+    public FieldExpressionValidatorDescription(String fieldName) {
+        super(fieldName);
+    }
+
+    public void setExpression(String expression) {
+        this.expression = expression;
+    }
+
+    @Override
+    public void setKey(String key) {
+        this.key = key;
+    }
+
+    @Override
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    @Override
+    public void setShortCircuit(boolean shortCircuit) {
+        this.shortCircuit = shortCircuit;
+    }
+
+
+    /**
+     * Returns the validator XML definition.
+     *
+     * @return the validator XML definition.
+     */
+    @Override
+    public String asFieldXml() {
+        StringWriter sw = new StringWriter();
+        PrintWriter writer = null;
+
+        try {
+            writer = new PrintWriter(sw);
+
+            if ( shortCircuit) {
+                writer.println("\t\t<field-validator type=\"fieldexpression\">");
+            } else {
+                writer.println("\t\t<field-validator type=\"fieldexpression\" short-circuit=\"true\">");
+            }
+
+            writer.println("\t\t\t<param name=\"expression\">" + expression+ "</param>");
+
+            if ( !"".equals(key)) {
+                writer.println("\t\t\t<message key=\"" + key + "\">" + message + "</message>");
+            } else {
+                writer.println("\t\t\t<message>" + message + "</message>");
+            }
+
+            writer.println("\t\t</field-validator>");
+
+        } finally {
+            if (writer != null) {
+                writer.flush();
+                writer.close();
+            }
+        }
+        return sw.toString();
+    }
+
+    /**
+     * Returns the validator XML definition.
+     *
+     * @return the validator XML definition.
+     */
+    @Override
+    public String asSimpleXml() {
+        throw new UnsupportedOperationException(getClass().getName() + " cannot be used for simple validators...");
+    }
+
+}