Commits

Anonymous committed fb3a3e8

Updated javadoc and tweaked if statements.

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@286e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits 1fa2c0d

Comments (0)

Files changed (1)

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

      * This method 'collects' all the validators for a given action invocation.
      *
      * It will traverse up the class hierarchy looking for validators for every super class
-     * and interface of the current action, as well as adding validators for any alias of
-     * this invocation. Nifty!
+     * and directly implemented interface of the current action, as well as adding validators for
+     * any alias of this invocation. Nifty!
      *
-     *  Given the following class structure:
-     *
-     *   interface Animal;
+     * Given the following class structure:
+     * <pre>
+     *   interface Thing;
+     *   interface Animal extends Thing;
      *   interface Quadraped extends Animal;
      *   class AnimalImpl implements Animal;
      *   class QuadrapedImpl extends AnimalImpl implements Quadraped;
      *   class Dog extends QuadrapedImpl;
+     * </pre>
      *
-     *  This method will look for the following config files:
-     *
+     * This method will look for the following config files for Dog:
+     * <pre>
      *   Animal
      *   Animal-context
      *   AnimalImpl
      *   QuadrapedImpl-context
      *   Dog
      *   Dog-context
+     * </pre>
      *
+     * Note that the validation rules for Thing is never looked for because no class in the
+     * hierarchy directly implements Thing.
      *
      * @param clazz the Class to look up validators for
      * @param context the context to use when looking up validators
             return validators;
         }
 
-        if (!clazz.equals(Object.class)) {
-            if (!clazz.isInterface()) {
-                validators.addAll(buildValidators(clazz.getSuperclass(), context, checkFile, checked));
-            } else {
-                Class[] interfaces = clazz.getInterfaces();
+        if (clazz.isInterface()) {
+            Class[] interfaces = clazz.getInterfaces();
 
-                for (int x = 0; x < interfaces.length; x++) {
-                    validators.addAll(buildValidators(interfaces[x], context, checkFile, checked));
-                }
+            for (int x = 0; x < interfaces.length; x++) {
+                validators.addAll(buildValidators(interfaces[x], context, checkFile, checked));
+            }
+        } else {
+            if (!clazz.equals(Object.class)) {
+                validators.addAll(buildValidators(clazz.getSuperclass(), context, checkFile, checked));
             }
         }