bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1060598 - in /incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic: DynamicValidatorContext.java DynamicValidatorFactory.java
Date Tue, 18 Jan 2011 22:11:52 GMT
Author: mbenson
Date: Tue Jan 18 22:11:52 2011
New Revision: 1060598

URL: http://svn.apache.org/viewvc?rev=1060598&view=rev
Log:
shared static metabean info

Modified:
    incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/DynamicValidatorContext.java
    incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/DynamicValidatorFactory.java

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/DynamicValidatorContext.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/DynamicValidatorContext.java?rev=1060598&r1=1060597&r2=1060598&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/DynamicValidatorContext.java
(original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/DynamicValidatorContext.java
Tue Jan 18 22:11:52 2011
@@ -27,6 +27,7 @@ import javax.validation.Validator;
 import javax.validation.ValidatorContext;
 
 import org.apache.bval.MetaBeanBuilder;
+import org.apache.bval.MetaBeanFactory;
 import org.apache.bval.MetaBeanFinder;
 import org.apache.bval.MetaBeanManager;
 import org.apache.bval.jsr303.AnnotationProcessor;
@@ -47,31 +48,19 @@ public class DynamicValidatorContext ext
 
     private class DynamicMetaBeanFinder extends MetaBeanManager {
 
-        final MetaBeanFinder staticFinder = new MetaBeanFinder() {
-
-            public MetaBean findForId(String beanInfoId) {
-                return DynamicMetaBeanFinder.this.findForId(beanInfoId);
-            }
-
-            public MetaBean findForClass(Class<?> clazz) {
-                return findStatic(clazz);
-            }
-        };
-
+        final MetaBeanFinder staticFinder;
         final DynamicMetaGraphManagerImpl metaGraphManager;
         final AnnotationProcessor annotationProcessor;
 
         /**
-         * Create a new DynamicValidatorContext.DynamicMetaBeanFinder instance.
+         * Create a new DynamicMetaBeanFinder instance.
+         * @param staticFinder
          */
-        public DynamicMetaBeanFinder(MetaBeanBuilder builder) {
-            super(builder);
+        public DynamicMetaBeanFinder(MetaBeanFinder staticFinder) {
+            super(new MetaBeanBuilder(new MetaBeanFactory[] {}));
             this.annotationProcessor = new AnnotationProcessor(DynamicValidatorContext.this);
             this.metaGraphManager = new DynamicMetaGraphManagerImpl(annotationProcessor,
staticFinder);
-        }
-
-        private MetaBean findStatic(Class<?> clazz) {
-            return super.findForClass(clazz);
+            this.staticFinder = staticFinder;
         }
 
         /**
@@ -87,7 +76,7 @@ public class DynamicValidatorContext ext
          * {@inheritDoc}
          */
         public MetaBean findForId(String beanInfoId) {
-            return super.findForId(beanInfoId);
+            return staticFinder.findForId(beanInfoId);
         }
 
     }
@@ -182,8 +171,16 @@ public class DynamicValidatorContext ext
      * {@inheritDoc}
      */
     @Override
+    public DynamicValidatorFactory getFactory() {
+        return (DynamicValidatorFactory) super.getFactory();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     protected MetaBeanFinder buildMetaBeanFinder() {
-        return new DynamicMetaBeanFinder(((MetaBeanManager) super.buildMetaBeanFinder()).getBuilder());
+        return new DynamicMetaBeanFinder(getFactory().metaBeanFinder);
     }
 
     /**

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/DynamicValidatorFactory.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/DynamicValidatorFactory.java?rev=1060598&r1=1060597&r2=1060598&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/DynamicValidatorFactory.java
(original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/DynamicValidatorFactory.java
Tue Jan 18 22:11:52 2011
@@ -18,6 +18,7 @@ package org.apache.bval.jsr303.dynamic;
 
 import javax.validation.spi.ConfigurationState;
 
+import org.apache.bval.MetaBeanFinder;
 import org.apache.bval.jsr303.ApacheValidatorFactory;
 
 /**
@@ -27,6 +28,8 @@ import org.apache.bval.jsr303.ApacheVali
  * @version $Rev$ $Date$
  */
 public class DynamicValidatorFactory extends ApacheValidatorFactory {
+    final MetaBeanFinder metaBeanFinder;
+
     /**
      * Create a new {@link DynamicValidatorFactory} instance.
      *
@@ -34,6 +37,7 @@ public class DynamicValidatorFactory ext
      */
     public DynamicValidatorFactory(ConfigurationState configurationState) {
         super(configurationState);
+        this.metaBeanFinder = super.usingContext().getMetaBeanFinder();
     }
 
     /*



Mime
View raw message