You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bval.apache.org by mb...@apache.org on 2011/02/01 17:45:17 UTC
svn commit: r1066090 -
/incubator/bval/sandbox/lang3-work/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java
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();