added copying of SingleRouterConfig.
[xmlrouter] / impl / src / main / java / org / wamblee / xmlrouter / impl / ConfigImpl.java
index a1733ab41bf84a9b84cb3986f460586871bd763e..8088be30e31df69d8bf87280f68d7bfef94bbf42 100644 (file)
@@ -49,6 +49,21 @@ public abstract class ConfigImpl<T extends Identifiable<T>> implements
         registered = new HashMap<Id<T>, T>();
     }
 
+    /**
+     * Copies the config object.
+     * 
+     * @param aConfig
+     *            Config to copy.
+     */
+    public ConfigImpl(ConfigImpl<T> aConfig) {
+        notNull("config", aConfig);
+        id = aConfig.id;
+        registered = new HashMap<Id<T>, T>();
+        for (Map.Entry<Id<T>, T> entry : aConfig.registered.entrySet()) {
+            registered.put(entry.getKey(), entry.getValue());
+        }
+    }
+
     @Override
     public Id<Config> getId() {
         return id;