incubator-bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1136235 - /incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ValidationContextTraversal.java
Date Wed, 15 Jun 2011 22:55:31 GMT
Author: mbenson
Date: Wed Jun 15 22:55:31 2011
New Revision: 1136235

URL: http://svn.apache.org/viewvc?rev=1136235&view=rev
Log:
best type consistency; resolve DynamicMetaBeans on completion

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

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ValidationContextTraversal.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ValidationContextTraversal.java?rev=1136235&r1=1136234&r2=1136235&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ValidationContextTraversal.java
(original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ValidationContextTraversal.java
Wed Jun 15 22:55:31 2011
@@ -105,7 +105,7 @@ public class ValidationContextTraversal 
         }
         Object value = validationContext.getBean();
         Object child = value == null ? null : access.get(value);
-        setType(access.getJavaType());
+        setType(child == null ? access.getJavaType() : child.getClass());
         validationContext.setBean(child,
             validationContext.getMetaBean().resolveMetaBean(child == null ? rawType : child));
     }
@@ -186,4 +186,16 @@ public class ValidationContextTraversal 
         return rawType;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void complete() {
+        super.complete();
+        MetaBean metaBean = validationContext.getMetaBean();
+        if (metaBean instanceof DynamicMetaBean) {
+            Class<?> defaultType = validationContext.getMetaProperty() == null ? rawType
: validationContext.getMetaProperty().getParentMetaBean().getBeanClass();
+            validationContext.setMetaBean(metaBean.resolveMetaBean(ObjectUtils.defaultIfNull(validationContext.getBean(),
defaultType)));
+        }
+    }
 }
\ No newline at end of file



Mime
View raw message