equality based on the ids of the contents of SingleRouterConfig.
[xmlrouter] / config / src / main / java / org / wamblee / xmlrouter / config / Config.java
index 263b0b66bfe7c0fbad9087dc6c8b2de21462cbdd..baa4c8b4d72d0f6d2c38bba418ba7f354882721c 100644 (file)
@@ -15,7 +15,7 @@
  */
 package org.wamblee.xmlrouter.config;
 
-import java.util.Map;
+import java.util.Collection;
 
 import org.wamblee.xmlrouter.common.Id;
 
@@ -28,16 +28,16 @@ import org.wamblee.xmlrouter.common.Id;
  * @param <T>
  *            Type for which ids are generated.
  */
-public interface Config<T> {
-
+public interface Config<T extends Identifiable> extends Identifiable<Config> {
     /**
-     * Adds a item
+     * Adds an item. No item with the same id may exist.
      * 
      * @param aT
      *            item
-     * @return Unique id.
+     * @throws ConfigException
+     *             In case an object with the same id already exists.
      */
-    Id<T> add(T aT);
+    void add(T aT);
 
     /**
      * Removes the item with a given id.
@@ -49,7 +49,7 @@ public interface Config<T> {
     boolean remove(Id<T> aId);
 
     /**
-     * @return All available ids.
+     * @return All available items.
      */
-    Map<Id<T>, T> map();
+    Collection<T> values();
 }
\ No newline at end of file