Commits

tm_jee  committed 48575f5

XW-547
- Refactor DefaultActionValidatorManager's validation logics to an abstract superclass

git-svn-id: http://svn.opensymphony.com/svn/xwork/branches/xwork_1-2@1576e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits 79ab790
  • Branches xwork_1-2

Comments (0)

Files changed (2)

File src/java/com/opensymphony/xwork/validator/AbstractActionValidatorManager.java

         sb.append(context);
         return sb.toString();
     }
+
+
+    protected List buildValidatorsFromValidatorConfig(List validatorConfigs) {
+        ArrayList validators = new ArrayList(validatorConfigs.size());
+        for (Iterator iterator = validatorConfigs.iterator(); iterator.hasNext(); ) {
+            ValidatorConfig cfg = (ValidatorConfig) iterator.next();
+            Validator validator = ValidatorFactory.getValidator(cfg);
+            validator.setValidatorType(cfg.getType());
+            validators.add(validator);
+        }
+        return validators;
+    }
 }

File src/java/com/opensymphony/xwork/validator/DefaultActionValidatorManager.java

         List cfgs = (List) validatorCache.get(validatorKey);
 
         // create clean instances of the validators for the caller's use
-        ArrayList validators = new ArrayList(cfgs.size());
-        for (Iterator iterator = cfgs.iterator(); iterator.hasNext(); ) {
-            ValidatorConfig cfg = (ValidatorConfig) iterator.next();
-            Validator validator = ValidatorFactory.getValidator(cfg);
-            validator.setValidatorType(cfg.getType());
-            validators.add(validator);
-        }
-
-        return validators;
+        return buildValidatorsFromValidatorConfig(cfgs);
     }