*/
package org.wamblee.xmlrouter.config;
-import java.util.Collection;
+import java.util.List;
import org.wamblee.xmlrouter.common.Id;
/**
- * Basic configuration interface for managing a set of configuration items of a
- * given type with unique ids.
+ * Interface for managing a set of configuration items of a given type with
+ * unique ids.
*
* @author Erik Brakkee
*
* @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.
boolean remove(Id<T> aId);
/**
- * @return All available ids.
- */
- Collection<Id<T>> ids();
-
- /**
- * Gets the item for the given id.
- *
- * @param aId
- * Item id.
- * @return Item, or null if not found.
+ * @return All available items.
*/
- T get(Id<T> aId);
-
+ List<T> values();
}
\ No newline at end of file