incubator-bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1066090 - /incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java
Date Tue, 01 Feb 2011 16:45:17 GMT
Author: mbenson
Date: Tue Feb  1 16:45:16 2011
New Revision: 1066090

URL: http://svn.apache.org/viewvc?rev=1066090&view=rev
Log:
make it possible for FeaturesCapable subclasses to use a specific type of features Map

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

Modified: incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java?rev=1066090&r1=1066089&r2=1066090&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java
(original)
+++ incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java
Tue Feb  1 16:45:16 2011
@@ -31,7 +31,7 @@ import org.apache.commons.lang3.ArrayUti
 public abstract class FeaturesCapable implements Serializable {
     private static final long serialVersionUID = -4045110242904814218L;
 
-    private ConcurrentMap<String, Object> features = new ConcurrentHashMap<String,
Object>();
+    private ConcurrentMap<String, Object> features = createFeaturesMap();
 
     /** key = validation id, value = the validation */
     private Validation[] validations = new Validation[0];
@@ -153,7 +153,8 @@ public abstract class FeaturesCapable im
      * @param target
      */
     protected <T extends FeaturesCapable> void copyInto(T target) {
-        target.features = new ConcurrentHashMap<String, Object>(features);
+        target.features = target.createFeaturesMap();
+        target.features.putAll(features);
         if (validations != null) {
             target.validations = validations.clone();
         }
@@ -203,6 +204,14 @@ public abstract class FeaturesCapable im
         return false;
     }
 
+    /**
+     * Create a features map for this {@link FeaturesCapable} object.
+     * @return ConcurrentMap
+     */
+    protected ConcurrentMap<String, Object> createFeaturesMap() {
+        return new ConcurrentHashMap<String, Object>();
+    }
+
     private boolean acquireLockIfNeeded() {
         if (locking) {
             lock.lock();



Mime
View raw message