Return-Path: Delivered-To: apmail-incubator-bval-commits-archive@minotaur.apache.org Received: (qmail 84467 invoked from network); 7 Sep 2010 19:06:18 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 Sep 2010 19:06:18 -0000 Received: (qmail 42120 invoked by uid 500); 7 Sep 2010 19:06:18 -0000 Delivered-To: apmail-incubator-bval-commits-archive@incubator.apache.org Received: (qmail 42102 invoked by uid 500); 7 Sep 2010 19:06:18 -0000 Mailing-List: contact bval-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: bval-dev@incubator.apache.org Delivered-To: mailing list bval-commits@incubator.apache.org Received: (qmail 42095 invoked by uid 99); 7 Sep 2010 19:06:18 -0000 Received: from Unknown (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Sep 2010 19:06:18 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Sep 2010 19:06:00 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C0C6E23889D7; Tue, 7 Sep 2010 19:05:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: bval-commits@incubator.apache.org From: mbenson@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100907190538.C0C6E23889D7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 null. + * Navigates a {@link ValidationContext} to a specified location, which may be + * null. */ 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) {