bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r992715 - /incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java
Date Sun, 05 Sep 2010 06:46:24 GMT
Author: mbenson
Date: Sun Sep  5 06:46:24 2010
New Revision: 992715

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

Modified:
    incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java

Modified: incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java?rev=992715&r1=992714&r2=992715&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java
(original)
+++ incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java
Sun Sep  5 06:46:24 2010
@@ -24,113 +24,120 @@ import static org.apache.bval.model.Feat
 /**
  * Description: Default implementation for the interface to find, register and
  * create MetaBeans. In most situations a single instance of this class is
- * sufficient and you can get this instance from the {@link MetaBeanManagerFactory}.
- * <br/>
+ * sufficient and you can get this instance from the
+ * {@link MetaBeanManagerFactory}. <br/>
  */
 public class MetaBeanManager implements MetaBeanFinder {
 
-  /** MetaBean cache */
-  protected final MetaBeanCache cache = new MetaBeanCache();
-  /** MetaBean builder */
-  protected final MetaBeanBuilder builder;
-  /** Complete flag */
-  protected boolean complete = false;
-
-  /**
-   * Create a new MetaBeanManager instance.
-   */
-  public MetaBeanManager() {
-    builder = new MetaBeanBuilder();
-  }
-
-  /**
-   * Create a new MetaBeanManager instance.
-   * @param builder
-   */
-  public MetaBeanManager(MetaBeanBuilder builder) {
-    this.builder = builder;
-  }
-
-  /**
-   * Get the builder used.
-   * @return {@link MetaBeanBuilder}
-   */
-  public MetaBeanBuilder getBuilder() {
-    return builder;
-  }
-
-  /**
-   * Get the cache used.
-   * @return {@link MetaBeanCache}
-   */
-  public MetaBeanCache getCache() {
-    return cache;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  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);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  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);
-    }
-  }
-
-  /**
-   * Compute all known relationships for <code>beanInfo</code>.
-   * 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);
-    }
-  }
-
-  /**
-   * Compute a single related {@link MetaBean}.
-   * @param prop
-   * @param 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));
+    /** MetaBean cache */
+    protected final MetaBeanCache cache = new MetaBeanCache();
+    /** MetaBean builder */
+    protected final MetaBeanBuilder builder;
+    /** Complete flag */
+    protected boolean complete = false;
+
+    /**
+     * Create a new MetaBeanManager instance.
+     */
+    public MetaBeanManager() {
+        builder = new MetaBeanBuilder();
+    }
+
+    /**
+     * Create a new MetaBeanManager instance.
+     * 
+     * @param builder
+     */
+    public MetaBeanManager(MetaBeanBuilder builder) {
+        this.builder = builder;
+    }
+
+    /**
+     * Get the builder used.
+     * 
+     * @return {@link MetaBeanBuilder}
+     */
+    public MetaBeanBuilder getBuilder() {
+        return builder;
+    }
+
+    /**
+     * Get the cache used.
+     * 
+     * @return {@link MetaBeanCache}
+     */
+    public MetaBeanCache getCache() {
+        return cache;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    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);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    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);
+        }
+    }
+
+    /**
+     * Compute all known relationships for <code>beanInfo</code>. 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);
+        }
+    }
+
+    /**
+     * Compute a single related {@link MetaBean}.
+     * 
+     * @param prop
+     * @param 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));
+        }
     }
-  }
 
 }



Mime
View raw message