*/
package org.wamblee.xmlrouter.impl;
+import static org.wamblee.xmlrouter.impl.MessageUtil.*;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
*/
// TODO make sure that each item inside this config is prefixed with the id of
// the config.
-public abstract class ConfigImpl<T extends Identifiable> implements
+public abstract class ConfigImpl<T extends Identifiable<T>> implements
ExtendedConfig<T> {
private Id<Config> id;
*/
@Override
public synchronized void add(T aT) {
- // TODO test duplicate ids.
- notNull(aT);
+ notNull("aT", aT);
registered.add(wrap(id.getId() + ".", aT));
}
*/
@Override
public synchronized boolean remove(Id<T> aId) {
- notNull(aId);
+ notNull("aId", aId);
Iterator<T> i = registered.iterator();
while (i.hasNext()) {
T t = i.next();
public List<T> values() {
return Collections.unmodifiableList(registered);
}
-
- private void notNull(T aT) {
- if (aT == null) {
- throw new NullPointerException("Object is null");
- }
- }
-
- private void notNull(Id<T> aId) {
- if (aId == null) {
- throw new NullPointerException("Id is null");
- }
- }
}