bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r993481 - /incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/NestedPathNavigator.java
Date Tue, 07 Sep 2010 19:05:38 GMT
Author: mbenson
Date: Tue Sep  7 19:05:38 2010
New Revision: 993481

URL: http://svn.apache.org/viewvc?rev=993481&view=rev
Log:
format

Modified:
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/NestedPathNavigator.java

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/NestedPathNavigator.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/NestedPathNavigator.java?rev=993481&r1=993480&r2=993481&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/NestedPathNavigator.java
(original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/NestedPathNavigator.java
Tue Sep  7 19:05:38 2010
@@ -33,7 +33,8 @@ import org.apache.bval.util.PropertyAcce
 import org.apache.commons.lang3.reflect.TypeUtils;
 
 /**
- * Navigates a {@link ValidationContext} to a specified location, which may be <code>null</code>.
+ * Navigates a {@link ValidationContext} to a specified location, which may be
+ * <code>null</code>.
  */
 public class NestedPathNavigator {
 
@@ -41,6 +42,7 @@ public class NestedPathNavigator {
 
         /**
          * Create a new NullSafePropertyAccess instance.
+         * 
          * @param clazz
          * @param propertyName
          */
@@ -59,15 +61,14 @@ public class NestedPathNavigator {
 
     /**
      * Navigate a {@link ValidationContext} down a nested path.
+     * 
      * @param validationContext
      * @param propertyPath
      */
-    public void navigate(ValidationContext<?> validationContext,
-            String propertyPath) {
+    public void navigate(ValidationContext<?> validationContext, String propertyPath)
{
         try {
             Traversal helper = new Traversal(validationContext);
-            StringTokenizer tokens = new StringTokenizer(propertyPath, ".[]",
-                    true);
+            StringTokenizer tokens = new StringTokenizer(propertyPath, ".[]", true);
             while (tokens.hasMoreTokens()) {
                 String token = tokens.nextToken();
                 if (".".equals(token)) {
@@ -78,9 +79,7 @@ public class NestedPathNavigator {
                     String key = tokens.nextToken();
                     token = tokens.nextToken();
                     if (!"]".equals(token)) {
-                        throw new ValidationException(
-                                "']' missing, invalid property format: "
-                                        + propertyPath);
+                        throw new ValidationException("']' missing, invalid property format:
" + propertyPath);
                     }
                     helper.handleIndexOrKey(key);
                     continue;
@@ -92,8 +91,7 @@ public class NestedPathNavigator {
         } catch (ValidationException ex) {
             throw ex;
         } catch (Exception ex) {
-            throw new ValidationException("invalid property format: "
-                    + propertyPath, ex);
+            throw new ValidationException("invalid property format: " + propertyPath, ex);
         }
     }
 
@@ -116,6 +114,7 @@ public class NestedPathNavigator {
 
         /**
          * Handle an index or key embedded in [].
+         * 
          * @param token
          */
         protected void handleIndexOrKey(String token) {
@@ -133,12 +132,13 @@ public class NestedPathNavigator {
             Object value = validationContext.getBean();
             Object child = access.get(value);
             setType(access.getJavaType());
-            validationContext.setBean(child, validationContext.getMetaBean()
-                    .resolveMetaBean(child == null ? rawType : child));
+            validationContext.setBean(child, validationContext.getMetaBean().resolveMetaBean(
+                child == null ? rawType : child));
         }
 
         /**
          * Handle a .-delimited property token.
+         * 
          * @param token
          */
         protected void handleProperty(String token) {
@@ -147,35 +147,35 @@ public class NestedPathNavigator {
             MetaBean metaBean = validationContext.getMetaBean();
 
             if (metaBean instanceof DynamicMetaBean) {
-                metaBean = metaBean
-                        .resolveMetaBean(validationContext.getBean() == null ? rawType
-                                : validationContext.getBean());
+                metaBean =
+                    metaBean.resolveMetaBean(validationContext.getBean() == null ? rawType
: validationContext
+                        .getBean());
             }
             MetaProperty mp = metaBean.getProperty(token);
             if (mp == null) {
-                throw new UnknownPropertyException("unknown property '" + token
-                        + "' in " + metaBean.getId());
+                throw new UnknownPropertyException("unknown property '" + token + "' in "
+ metaBean.getId());
             }
             validationContext.setMetaProperty(mp);
             setType(mp.getType());
         }
 
         /**
-         * If we currently have a property, navigate the context such that the property becomes
the bean,
-         * in preparation for another property.
+         * If we currently have a property, navigate the context such that the
+         * property becomes the bean, in preparation for another property.
+         * 
          * @param validationContext
          */
         protected void moveDownIfNecessary() {
             MetaProperty mp = validationContext.getMetaProperty();
             if (mp != null) {
-                validationContext.moveDown(mp, new NullSafePropertyAccess(
-                        validationContext.getMetaBean().getBeanClass(), mp
-                                .getName()));
+                validationContext.moveDown(mp, new NullSafePropertyAccess(validationContext.getMetaBean()
+                    .getBeanClass(), mp.getName()));
             }
         }
 
         /**
          * Set the type of the expression processed thus far.
+         * 
          * @param type
          */
         protected void setType(Type type) {



Mime
View raw message