You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rd...@apache.org on 2005/10/22 16:42:26 UTC

svn commit: r327667 - in /jakarta/commons/proper/betwixt/trunk: project.xml src/java/org/apache/commons/betwixt/strategy/DefaultIdStoringStrategy.java xdocs/tasks.xml

Author: rdonkin
Date: Sat Oct 22 07:42:21 2005
New Revision: 327667

URL: http://svn.apache.org/viewcvs?rev=327667&view=rev
Log:
Added convenience constructor to DefaultIdStorageStrategy. Helpful when you want to us object identity (rather than equality).

Modified:
    jakarta/commons/proper/betwixt/trunk/project.xml
    jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/strategy/DefaultIdStoringStrategy.java
    jakarta/commons/proper/betwixt/trunk/xdocs/tasks.xml

Modified: jakarta/commons/proper/betwixt/trunk/project.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/betwixt/trunk/project.xml?rev=327667&r1=327666&r2=327667&view=diff
==============================================================================
--- jakarta/commons/proper/betwixt/trunk/project.xml (original)
+++ jakarta/commons/proper/betwixt/trunk/project.xml Sat Oct 22 07:42:21 2005
@@ -137,6 +137,10 @@
   </developers>
     <contributors>
     <contributor>
+      <name>Christian Aust</name>
+      <email></email>
+    </contributor>
+    <contributor>
       <name>Dave Brosius</name>
       <email></email>
     </contributor>

Modified: jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/strategy/DefaultIdStoringStrategy.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/strategy/DefaultIdStoringStrategy.java?rev=327667&r1=327666&r2=327667&view=diff
==============================================================================
--- jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/strategy/DefaultIdStoringStrategy.java (original)
+++ jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/strategy/DefaultIdStoringStrategy.java Sat Oct 22 07:42:21 2005
@@ -21,8 +21,14 @@
 import org.apache.commons.betwixt.expression.Context;
 
 /**
- * Stores every ID that given to it into an internal <code>HashMap</code> and
+ * <p>Stores every ID that given to it into an internal <code>HashMap</code> and
  * returns it on request.
+ * </p><p>
+ * {@link DefaultIdStoringStrategy(Map, Map)} allows the implementations
+ * to be specified.
+ * For example, those who want to use identity (rather than equality) 
+ * should pass a <code>IdentityHashMap</code> instance.
+ * </p>
  * 
  * @author <a href="mailto:christian@wilde-welt.de">Christian Aust</a>
  * @since 0.7
@@ -32,14 +38,26 @@
     private Map beanByIdMap;
 
     /**
-     * Constructs a {@link IdStoringStrategy}using a <code>HashMap</code> for
+     * Constructs a {@link IdStoringStrategy} using a <code>HashMap</code> for
      * storage.
      */
     public DefaultIdStoringStrategy() {
-        idByBeanMap = new HashMap();
-        beanByIdMap = new HashMap();
+        this(new HashMap(), new HashMap());
     }
 
+    /**
+     * Constructs a {@link IdStoringStrategy}using the <code>Map</code> 
+     * implementations provided for storage.
+     * 
+     * @param idByBeanMap <code>Map</code> implementation stores the ID's by bean
+     * @param beanByIdMap <code>Map</code> implementation stores the bean's by ID
+     */
+    public DefaultIdStoringStrategy(Map idByBeanMap, Map beanByIdMap) {
+        this.idByBeanMap = idByBeanMap;
+        this.beanByIdMap = beanByIdMap;
+    }
+
+    
     /**
      * Returns a String id for the given bean if it has been stored previously.
      * Otherwise returns null.

Modified: jakarta/commons/proper/betwixt/trunk/xdocs/tasks.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/betwixt/trunk/xdocs/tasks.xml?rev=327667&r1=327666&r2=327667&view=diff
==============================================================================
--- jakarta/commons/proper/betwixt/trunk/xdocs/tasks.xml (original)
+++ jakarta/commons/proper/betwixt/trunk/xdocs/tasks.xml Sat Oct 22 07:42:21 2005
@@ -200,6 +200,11 @@
     <subsection name='Since 0.7'>            
         <ul>
             <li>
+Added convenience constructor to DefaultIdStoringStrategy.
+This makes life easier for users that want to use object identity
+(rather than equality) when generating IDs.
+            </li>
+            <li>
 Fixed TextRule content bug. (Issue #36930).
             </li>
             <li>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org