incubator-bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romanst...@apache.org
Subject svn commit: r955870 - in /incubator/bval/trunk: bval-core/src/main/java/org/apache/bval/ bval-jsr303/src/main/java/org/apache/bval/jsr303/ bval-xstream/src/main/java/org/apache/bval/xml/
Date Fri, 18 Jun 2010 07:32:08 GMT
Author: romanstumm
Date: Fri Jun 18 07:32:08 2010
New Revision: 955870

URL: http://svn.apache.org/viewvc?rev=955870&view=rev
Log:
BVAL-69 MetaBeanFinder.findAll() removed, compile error (classloading issue) fixed

Modified:
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidator.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanFinder.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java
    incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanManagerFactory.java
    incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheFactoryContext.java
    incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManager.java
    incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanReference.java

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidator.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidator.java?rev=955870&r1=955869&r2=955870&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidator.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/BeanValidator.java Fri Jun
18 07:32:08 2010
@@ -354,7 +354,7 @@ public class BeanValidator<T extends Val
 
     /**
      * the metabean finder associated with this validator.
-     * @see org.apache.bval.MetaBeanManagerFactory#getFinder() 
+     * @see org.apache.bval.MetaBeanManagerFactory#getFinder()
      * @return a MetaBeanFinder
      */
     public MetaBeanFinder getMetaBeanFinder() {

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanFinder.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanFinder.java?rev=955870&r1=955869&r2=955870&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanFinder.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanFinder.java Fri Jun
18 07:32:08 2010
@@ -17,8 +17,6 @@
 package org.apache.bval;
 
 
-import java.util.Map;
-
 import org.apache.bval.model.MetaBean;
 
 /**
@@ -38,9 +36,4 @@ public interface MetaBeanFinder {
      */
     MetaBean findForClass(Class<?> clazz);
 
-    /**
-     * @return all MetaBeans for classes that have a xml descriptor:
-     *         key = bean.id, value = MetaBean
-     */
-    public Map<String, MetaBean> findAll();
 }

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java?rev=955870&r1=955869&r2=955870&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java (original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java Fri
Jun 18 07:32:08 2010
@@ -19,8 +19,6 @@ package org.apache.bval;
 import org.apache.bval.model.MetaBean;
 import org.apache.bval.model.MetaProperty;
 
-import java.util.Map;
-
 import static org.apache.bval.model.Features.Property.*;
 
 /**
@@ -31,117 +29,78 @@ import static org.apache.bval.model.Feat
  */
 public class MetaBeanManager implements MetaBeanFinder {
 
-    protected final MetaBeanCache cache = new MetaBeanCache();
-    protected final MetaBeanBuilder builder;
-    protected boolean complete = false;
-
-    public MetaBeanManager() {
-        builder = new MetaBeanBuilder();
+  protected final MetaBeanCache cache = new MetaBeanCache();
+  protected final MetaBeanBuilder builder;
+  protected boolean complete = false;
+
+  public MetaBeanManager() {
+    builder = new MetaBeanBuilder();
+  }
+
+  public MetaBeanManager(MetaBeanBuilder builder) {
+    this.builder = builder;
+  }
+
+  public MetaBeanBuilder getBuilder() {
+    return builder;
+  }
+
+  public MetaBeanCache getCache() {
+    return cache;
+  }
+
+  public MetaBean findForId(String beanInfoId) {
+    MetaBean beanInfo = cache.findForId(beanInfoId);
+    if (beanInfo != null) return beanInfo;
+    try {
+      beanInfo = builder.buildForId(beanInfoId);
+      cache.cache(beanInfo);
+      computeRelationships(beanInfo);
+      return beanInfo;
+    } catch (RuntimeException e) {
+      throw e; // do not wrap runtime exceptions
+    } catch (Exception e) {
+      throw new IllegalArgumentException(
+          "error creating beanInfo with id: " + beanInfoId, e);
+    }
+  }
+
+  public MetaBean findForClass(Class<?> clazz) {
+    if (clazz == null) return null;
+    MetaBean beanInfo = cache.findForClass(clazz);
+    if (beanInfo != null) return beanInfo;
+    try {
+      beanInfo = builder.buildForClass(clazz);
+      cache.cache(beanInfo);
+      computeRelationships(beanInfo);
+      return beanInfo;
+    } catch (RuntimeException e) {
+      throw e; // do not wrap runtime exceptions
+    } catch (Exception e) {
+      throw new IllegalArgumentException("error creating beanInfo for " + clazz, e);
+    }
+  }
+
+  /**
+   * must be called AFTER cache.cache()
+   * to avoid endless loop
+   *
+   * @param beanInfo - the bean for which to compute relationships
+   */
+  protected void computeRelationships(MetaBean beanInfo) {
+    for (MetaProperty prop : beanInfo.getProperties()) {
+      String beanRef = (String) prop.getFeature(REF_BEAN_ID);
+      computeRelatedMetaBean(prop, beanRef);
+    }
+  }
+
+  protected void computeRelatedMetaBean(MetaProperty prop, String beanRef) {
+    Class<?> beanType = prop.getFeature(REF_BEAN_TYPE);
+    if (beanType != null) {
+      prop.setMetaBean(findForClass(beanType));
+    } else if (prop.getFeature(REF_CASCADE) != null) { // dynamic type resolution:
+      prop.setMetaBean(new DynamicMetaBean(this));
     }
+  }
 
-    public MetaBeanManager(MetaBeanBuilder builder) {
-        this.builder = builder;
-    }
-
-    public MetaBeanBuilder getBuilder() {
-        return builder;
-    }
-
-    public MetaBeanCache getCache() {
-        return cache;
-    }
-
-    /**
-     * @return all MetaBeans for classes that have a xml descriptor:
-     *         key = bean.id, value = MetaBean
-     */
-    public Map<String, MetaBean> findAll() {
-        if (!complete) {
-            try {
-                Map<String, MetaBean> allBuilt = builder.buildAll();
-                for (MetaBean meta : allBuilt.values()) {
-                    MetaBean cached = cache.findForId(meta.getId());
-                    if (cached == null) {
-                        cache.cache(meta);
-                    }
-                }
-                Map<String, MetaBean> map = cache.findAll();
-                for (Object oentry : map.values()) {
-                    MetaBean meta = (MetaBean) oentry;
-                    computeRelationships(meta, map);
-                }
-                complete = true;
-                return map;
-            } catch (RuntimeException e) {
-                throw e; // do not wrap runtime exceptions
-            } catch (Exception e) {
-                throw new IllegalArgumentException("error creating beanInfos", e);
-            }
-        } else {
-            return cache.findAll();
-        }
-    }
-
-    public MetaBean findForId(String beanInfoId) {
-        MetaBean beanInfo = cache.findForId(beanInfoId);
-        if (beanInfo != null) return beanInfo;
-        try {
-            beanInfo = builder.buildForId(beanInfoId);
-            cache.cache(beanInfo);
-            computeRelationships(beanInfo);
-            return beanInfo;
-        } catch (RuntimeException e) {
-            throw e; // do not wrap runtime exceptions
-        } catch (Exception e) {
-            throw new IllegalArgumentException(
-                  "error creating beanInfo with id: " + beanInfoId, e);
-        }
-    }
-
-    public MetaBean findForClass(Class<?> clazz) {
-        if (clazz == null) return null;
-        MetaBean beanInfo = cache.findForClass(clazz);
-        if (beanInfo != null) return beanInfo;
-        try {
-            beanInfo = builder.buildForClass(clazz);
-            cache.cache(beanInfo);
-            computeRelationships(beanInfo);
-            return beanInfo;
-        } catch (RuntimeException e) {
-            throw e; // do not wrap runtime exceptions
-        } catch (Exception e) {
-            throw new IllegalArgumentException("error creating beanInfo for " + clazz, e);
-        }
-    }
-
-    /**
-     * must be called AFTER cache.cache()
-     * to avoid endless loop
-     */
-    protected void computeRelationships(MetaBean beanInfo) {
-        for (MetaProperty prop : beanInfo.getProperties()) {
-            String beanRef = (String) prop.getFeature(REF_BEAN_ID);
-            if (beanRef != null) {
-                prop.setMetaBean(findForId(beanRef));
-            } else {
-                Class<?> beanType = prop.getFeature(REF_BEAN_TYPE);
-                if (beanType != null) {
-                    prop.setMetaBean(findForClass(beanType));
-                } // dynamic type resolution:
-                else if (prop.getFeature(REF_CASCADE) != null) {
-                    prop.setMetaBean(new DynamicMetaBean(this));
-//                            findForClass(prop.getType()));
-                }
-            }
-        }
-    }
-
-    protected void computeRelationships(MetaBean beanInfo, Map<String, MetaBean> cached)
{
-        for (MetaProperty prop : beanInfo.getProperties()) {
-            String beanRef = (String) prop.getFeature(REF_BEAN_ID);
-            if (beanRef != null) {
-                prop.setMetaBean(cached.get(beanRef));
-            }
-        }
-    }
 }

Modified: incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanManagerFactory.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanManagerFactory.java?rev=955870&r1=955869&r2=955870&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanManagerFactory.java
(original)
+++ incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/MetaBeanManagerFactory.java
Fri Jun 18 07:32:08 2010
@@ -28,7 +28,7 @@ public class MetaBeanManagerFactory {
 
     /**
      * global meta bean finder.
-     * @return
+     * @return the singleton
      */
     public static MetaBeanFinder getFinder() {
         return manager;

Modified: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheFactoryContext.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheFactoryContext.java?rev=955870&r1=955869&r2=955870&view=diff
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheFactoryContext.java
(original)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheFactoryContext.java
Fri Jun 18 07:32:08 2010
@@ -32,104 +32,113 @@ import java.util.List;
  * instances.<br/>
  */
 public class ApacheFactoryContext implements ValidatorContext {
-    private final ApacheValidatorFactory factory;
-    private final MetaBeanFinder metaBeanFinder;
+  private final ApacheValidatorFactory factory;
+  private final MetaBeanFinder metaBeanFinder;
 
-    private MessageInterpolator messageInterpolator;
-    private TraversableResolver traversableResolver;
-    private ConstraintValidatorFactory constraintValidatorFactory;
-
-    public ApacheFactoryContext(ApacheValidatorFactory factory) {
-        this.factory = factory;
-        this.metaBeanFinder = buildMetaBeanManager();
-    }
+  private MessageInterpolator messageInterpolator;
+  private TraversableResolver traversableResolver;
+  private ConstraintValidatorFactory constraintValidatorFactory;
+
+  public ApacheFactoryContext(ApacheValidatorFactory factory) {
+    this.factory = factory;
+    this.metaBeanFinder = buildMetaBeanManager();
+  }
 
-    protected ApacheFactoryContext(ApacheValidatorFactory factory,
-                                     MetaBeanFinder metaBeanFinder) {
-        this.factory = factory;
-        this.metaBeanFinder = metaBeanFinder;
-    }
+  protected ApacheFactoryContext(ApacheValidatorFactory factory,
+                                 MetaBeanFinder metaBeanFinder) {
+    this.factory = factory;
+    this.metaBeanFinder = metaBeanFinder;
+  }
 
-    public ApacheValidatorFactory getFactory() {
-        return factory;
-    }
+  public ApacheValidatorFactory getFactory() {
+    return factory;
+  }
 
-    public final MetaBeanFinder getMetaBeanFinder() {
-        return metaBeanFinder;
-    }
+  public final MetaBeanFinder getMetaBeanFinder() {
+    return metaBeanFinder;
+  }
 
-    public ValidatorContext messageInterpolator(MessageInterpolator messageInterpolator)
{
-        this.messageInterpolator = messageInterpolator;
-        return this;
-    }
+  public ValidatorContext messageInterpolator(MessageInterpolator messageInterpolator) {
+    this.messageInterpolator = messageInterpolator;
+    return this;
+  }
 
-    public ValidatorContext traversableResolver(TraversableResolver traversableResolver)
{
-        this.traversableResolver = traversableResolver;
-        return this;
-    }
+  public ValidatorContext traversableResolver(TraversableResolver traversableResolver) {
+    this.traversableResolver = traversableResolver;
+    return this;
+  }
 
-    public ValidatorContext constraintValidatorFactory(
-          ConstraintValidatorFactory constraintValidatorFactory) {
-        this.constraintValidatorFactory = constraintValidatorFactory;
-        return this;
-    }
+  public ValidatorContext constraintValidatorFactory(
+      ConstraintValidatorFactory constraintValidatorFactory) {
+    this.constraintValidatorFactory = constraintValidatorFactory;
+    return this;
+  }
 
-    public ConstraintValidatorFactory getConstraintValidatorFactory() {
-        return constraintValidatorFactory == null ? factory.getConstraintValidatorFactory()
:
-              constraintValidatorFactory;
-    }
+  public ConstraintValidatorFactory getConstraintValidatorFactory() {
+    return constraintValidatorFactory == null ? factory.getConstraintValidatorFactory() :
+        constraintValidatorFactory;
+  }
 
-    public Validator getValidator() {
-        ClassValidator validator = new ClassValidator(this);
-        if (Boolean.getBoolean(factory.getProperties().get(
-              ApacheValidatorConfiguration.Properties.TREAT_MAPS_LIKE_BEANS))) {
-            validator.setTreatMapsLikeBeans(true);
-        }
-        return validator;
+  public Validator getValidator() {
+    ClassValidator validator = new ClassValidator(this);
+    if (Boolean.getBoolean(factory.getProperties().get(
+        ApacheValidatorConfiguration.Properties.TREAT_MAPS_LIKE_BEANS))) {
+      validator.setTreatMapsLikeBeans(true);
     }
+    return validator;
+  }
 
-    public MessageInterpolator getMessageInterpolator() {
-        return messageInterpolator == null ? factory.getMessageInterpolator() :
-              messageInterpolator;
-    }
+  public MessageInterpolator getMessageInterpolator() {
+    return messageInterpolator == null ? factory.getMessageInterpolator() :
+        messageInterpolator;
+  }
 
-    public TraversableResolver getTraversableResolver() {
-        return traversableResolver == null ? factory.getTraversableResolver() :
-              traversableResolver;
-    }
+  public TraversableResolver getTraversableResolver() {
+    return traversableResolver == null ? factory.getTraversableResolver() :
+        traversableResolver;
+  }
 
-    /**
-     * Create MetaBeanManager that
-     * uses JSR303-XML + JSR303-Annotations
-     * to build meta-data from.
-     * @return a new instance of MetaBeanManager with adequate MetaBeanFactories
-     */
-    protected MetaBeanManager buildMetaBeanManager() {
-        // this is relevant: xml before annotations
-        // (because ignore-annotations settings in xml)
-        List<MetaBeanFactory> builders = new ArrayList<MetaBeanFactory>(3);
-        if (Boolean.parseBoolean(factory.getProperties().get(
-              ApacheValidatorConfiguration.Properties.ENABLE_INTROSPECTOR))) {
-            builders.add(new IntrospectorMetaBeanFactory());
-        }
-        builders.add(new Jsr303MetaBeanFactory(this));
-        // as long as we support both: jsr303 and xstream-xml metabeans:
-        if (Boolean.parseBoolean(factory.getProperties().get(
-              ApacheValidatorConfiguration.Properties.ENABLE_METABEANS_XML))) {
-          return createXMLMetaBeanManager(builders);
-        } else {
-          return createMetaBeanManager(builders);
-        }
+  /**
+   * Create MetaBeanManager that
+   * uses JSR303-XML + JSR303-Annotations
+   * to build meta-data from.
+   *
+   * @return a new instance of MetaBeanManager with adequate MetaBeanFactories
+   */
+  protected MetaBeanManager buildMetaBeanManager() {
+    // this is relevant: xml before annotations
+    // (because ignore-annotations settings in xml)
+    List<MetaBeanFactory> builders = new ArrayList<MetaBeanFactory>(3);
+    if (Boolean.parseBoolean(factory.getProperties().get(
+        ApacheValidatorConfiguration.Properties.ENABLE_INTROSPECTOR))) {
+      builders.add(new IntrospectorMetaBeanFactory());
+    }
+    builders.add(new Jsr303MetaBeanFactory(this));
+    // as long as we support both: jsr303 and xstream-xml metabeans:
+    if (Boolean.parseBoolean(factory.getProperties().get(
+        ApacheValidatorConfiguration.Properties.ENABLE_METABEANS_XML))) {
+      return XMLMetaBeanManagerCreator.createXMLMetaBeanManager(builders);
+    } else {
+      return createMetaBeanManager(builders);
     }
+  }
 
   protected MetaBeanManager createMetaBeanManager(List<MetaBeanFactory> builders) {
     return new MetaBeanManager(
-      new MetaBeanBuilder(builders.toArray(new MetaBeanFactory[builders.size()])));
+        new MetaBeanBuilder(builders.toArray(new MetaBeanFactory[builders.size()])));
   }
 
-  protected MetaBeanManager createXMLMetaBeanManager(List<MetaBeanFactory> builders)
{
-    builders.add(new XMLMetaBeanFactory());
-    return new XMLMetaBeanManager(
-        new XMLMetaBeanBuilder(builders.toArray(new MetaBeanFactory[builders.size()])));
+  /**
+   * separate class to prevent the classloader to immediately load
+   * optional classes: XMLMetaBeanManager, XMLMetaBeanFactory, XMLMetaBeanBuilder
+   * that might not be available in the classpath
+   */
+  private static class XMLMetaBeanManagerCreator {
+
+    protected static MetaBeanManager createXMLMetaBeanManager(List<MetaBeanFactory>
builders) {
+      builders.add(new XMLMetaBeanFactory());
+      return new XMLMetaBeanManager(
+          new XMLMetaBeanBuilder(builders.toArray(new MetaBeanFactory[builders.size()])));
+    }
   }
 }
\ No newline at end of file

Modified: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManager.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManager.java?rev=955870&r1=955869&r2=955870&view=diff
==============================================================================
--- incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManager.java
(original)
+++ incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManager.java
Fri Jun 18 07:32:08 2010
@@ -16,12 +16,16 @@
  */
 package org.apache.bval.xml;
 
+import org.apache.bval.MetaBeanFinder;
 import org.apache.bval.MetaBeanManager;
 import org.apache.bval.model.MetaBean;
+import org.apache.bval.model.MetaProperty;
 import org.apache.bval.util.PrivilegedActions;
 
 import java.util.Map;
 
+import static org.apache.bval.model.Features.Property.REF_BEAN_ID;
+
 /**
  * Description: internal implementation class to construct
  * metabeans with factories and from xstream xml files.
@@ -33,7 +37,8 @@ import java.util.Map;
  * Date: 17.06.2010<br>
  * Time: 09:47:14<br>
  */
-public class XMLMetaBeanManager extends MetaBeanManager implements XMLMetaBeanRegistry, MetaBeanEnricher
{
+public class XMLMetaBeanManager extends MetaBeanManager
+    implements MetaBeanFinder, XMLMetaBeanRegistry, MetaBeanEnricher {
   public XMLMetaBeanManager() {
     this(new XMLMetaBeanBuilder());
   }
@@ -48,7 +53,7 @@ public class XMLMetaBeanManager extends 
   }
 
   public synchronized void addLoader(XMLMetaBeanLoader loader) {
-    ((XMLMetaBeanBuilder)builder).addLoader(loader);
+    ((XMLMetaBeanBuilder) builder).addLoader(loader);
     cache.clear(); // clear because new loaders can affect ALL MetaBeans already created!
     complete = false;
   }
@@ -64,7 +69,7 @@ public class XMLMetaBeanManager extends 
   public Map<String, MetaBean> enrichCopies(XMLMetaBeanInfos... infos) {
     Map<String, MetaBean> cached = findAll();
     try {
-      Map<String, MetaBean> patched = ((XMLMetaBeanBuilder)builder).enrichCopies(cached,
infos);
+      Map<String, MetaBean> patched = ((XMLMetaBeanBuilder) builder).enrichCopies(cached,
infos);
       for (Object entry : patched.values()) {
         MetaBean meta = (MetaBean) entry;
         computeRelationships(meta, patched);
@@ -76,4 +81,53 @@ public class XMLMetaBeanManager extends 
       throw new IllegalArgumentException("error enriching beanInfos", e);
     }
   }
+
+  /**
+   * 
+   * @return all MetaBeans for classes that have a xml descriptor:
+   *         key = bean.id, value = MetaBean
+   */
+  public Map<String, MetaBean> findAll() {
+    if (!complete) {
+      try {
+        Map<String, MetaBean> allBuilt = builder.buildAll();
+        for (MetaBean meta : allBuilt.values()) {
+          MetaBean cached = cache.findForId(meta.getId());
+          if (cached == null) {
+            cache.cache(meta);
+          }
+        }
+        Map<String, MetaBean> map = cache.findAll();
+        for (Object oentry : map.values()) {
+          MetaBean meta = (MetaBean) oentry;
+          computeRelationships(meta, map);
+        }
+        complete = true;
+        return map;
+      } catch (RuntimeException e) {
+        throw e; // do not wrap runtime exceptions
+      } catch (Exception e) {
+        throw new IllegalArgumentException("error creating beanInfos", e);
+      }
+    } else {
+      return cache.findAll();
+    }
+  }
+
+  protected void computeRelationships(MetaBean beanInfo, Map<String, MetaBean> cached)
{
+    for (MetaProperty prop : beanInfo.getProperties()) {
+      String beanRef = (String) prop.getFeature(REF_BEAN_ID);
+      if (beanRef != null) {
+        prop.setMetaBean(cached.get(beanRef));
+      }
+    }
+  }
+
+  protected void computeRelatedMetaBean(MetaProperty prop, String beanRef) {
+    if (beanRef != null) {
+        prop.setMetaBean(findForId(beanRef));
+    } else {
+      super.computeRelatedMetaBean(prop, beanRef);
+    }
+  }
 }

Modified: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanReference.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanReference.java?rev=955870&r1=955869&r2=955870&view=diff
==============================================================================
--- incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanReference.java
(original)
+++ incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanReference.java
Fri Jun 18 07:32:08 2010
@@ -18,10 +18,9 @@ package org.apache.bval.xml;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
 import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
+import org.apache.bval.model.Features;
 import org.apache.bval.model.MetaProperty;
 
-import static org.apache.bval.model.Features.Property.REF_BEAN_ID;
-
 /**
  * Description: <br/>
  */
@@ -50,7 +49,7 @@ public class XMLMetaBeanReference extend
     public void mergeInto(MetaProperty prop) throws ClassNotFoundException {
         super.mergeInto(prop);   // call super!
         if (getBeanId() != null) {
-            prop.putFeature(REF_BEAN_ID, getBeanId());
+            prop.putFeature(Features.Property.REF_BEAN_ID, getBeanId());
         }
     }
 }



Mime
View raw message