Commits

Anonymous committed 6a8eef3

remove com.opensymphony.xwork2.validator.annotations.StringRegexValidator

Issue Number: XW-498

git-svn-id: http://svn.opensymphony.com/svn/xwork/branches/2.0@1408e221344d-f017-0410-9bd5-d282ab1896d7

Comments (0)

Files changed (3)

src/java/com/opensymphony/xwork2/validator/AnnotationValidationConfigurationBuilder.java

                     }
 
                 }
-                // Process StringRegexValidator
-                else if ( a instanceof StringRegexValidator) {
-                    StringRegexValidator v = (StringRegexValidator) a;
-                    ValidatorConfig temp = processStringRegexValidatorAnnotation(v, fieldName);
-                    if ( temp != null) {
-                        result.add(temp);
-                    }
-
-                }
             }
             
             if (methodName != null) {
                 }
             }
         }
-        StringRegexValidator[] srv = validations.stringRegexs();
-        if ( srv != null ) {
-            for (StringRegexValidator v : srv) {
-                ValidatorConfig temp = processStringRegexValidatorAnnotation(v, fieldName);
-                if (temp != null) {
-                    result.add(temp);
-                }
-            }
-        }
         UrlValidator[] uv = validations.urls();
         if ( uv != null ) {
             for (UrlValidator v : uv) {
         return vCfg;
     }
 
-    private static ValidatorConfig processStringRegexValidatorAnnotation(StringRegexValidator v, String fieldName) {
-        String validatorType = "stringregex";
-
-        Map<String, Object> params = new HashMap<String, Object>();
-
-        if (fieldName != null) {
-            params.put("fieldName", fieldName);
-        } else if (v.fieldName() != null && v.fieldName().length() > 0 ) {
-            params.put("fieldName", v.fieldName());
-        }
-
-        params.put("caseSensitive", v.caseSensitive());
-        params.put("regex", v.regex());
-
-        ValidatorFactory.lookupRegisteredValidatorType(validatorType);
-        ValidatorConfig vCfg = new ValidatorConfig(validatorType, params);
-        vCfg.setShortCircuit(v.shortCircuit());
-        vCfg.setDefaultMessage(v.message());
-
-        String key = v.key();
-
-        if ((key != null) && (key.trim().length() > 0)) {
-            vCfg.setMessageKey(key);
-        }
-
-        return vCfg;
-    }
-
     private static ValidatorConfig processRegexFieldValidatorAnnotation(RegexFieldValidator v, String fieldName) {
         String validatorType = "regex";
 

src/java/com/opensymphony/xwork2/validator/annotations/StringRegexValidator.java

-/*
- * Copyright (c) 2002-2006 by OpenSymphony
- * All rights reserved.
- */
-
-package com.opensymphony.xwork2.validator.annotations;
-
-import java.lang.annotation.*;
-
-/**
- * <!-- START SNIPPET: description -->
- * StringRegexValidator checks that a given String field, if not empty,
- * matches the configured 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'> regex</td>
- * <td class='confluenceTd'> yes </td>
- * <td class='confluenceTd'> "." </td>
- * <td class='confluenceTd'> String property.  The Regular Expression for which to check a match.  </td>
- * </tr>
- * <tr>
- * <td class='confluenceTd'> caseSensitive</td>
- * <td class='confluenceTd'> no </td>
- * <td class='confluenceTd'> true </td>
- * <td class='confluenceTd'> Whether the matching of alpha characters in the expression should be done case-sensitively. </td>
- * </tr>
- * </table>
- * <!-- END SNIPPET: parameters -->
- *
- * <p/> <u>Example code:</u>
- *
- * <pre>
- * <!-- START SNIPPET: example -->
- * &#64;StringRegexValidator(message = "Default message", key = "i18n.key", shortCircuit = true, regex = "a regular expression", caseSensitive = true)
- * <!-- END SNIPPET: example -->
- * </pre>
- *
- * @author <a href="mailto:hermanns@aixcept.de">Rainer Hermanns</a>
- * @version $Id$
- */
-@Target({ElementType.METHOD})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface StringRegexValidator {
-
-    /**
-     * The default error message for this validator.
-     */
-    String message();
-
-    /**
-     * The message key to lookup for i18n.
-     */
-    String key() default "";
-
-    /**
-     * The optional fieldName for SIMPLE validator types.
-     */
-    String fieldName() default "";
-
-    /**
-     * String property. The Regular ExpressionValidator for which to check a match.
-     */
-    String regex();
-
-    /**
-     * Whether the matching of alpha characters in the expression should be done case-sensitively.
-     */
-    boolean caseSensitive() default true;
-
-    /**
-     * 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;
-}

src/java/com/opensymphony/xwork2/validator/annotations/Validations.java

  * <td class='confluenceTd'> Add list of VisitorFieldValidators </td>
  * </tr>
  * <tr>
- * <td class='confluenceTd'> stringRegexs </td>
- *
- * <td class='confluenceTd'> no </td>
- * <td class='confluenceTd'> Add list of StringRegexValidator </td>
- * </tr>
- * <tr>
  * <td class='confluenceTd'> regexFields </td>
  * <td class='confluenceTd'> no </td>
  * <td class='confluenceTd'> Add list of RegexFieldValidator </td>
     
     public VisitorFieldValidator[] visitorFields() default {};
 
-    public StringRegexValidator[] stringRegexs() default {};
-
     public RegexFieldValidator[] regexFields() default {};
 
     public ExpressionValidator[] expressions() default {};
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.