git://wamblee.org
/
xmlrouter
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
now making sure that ids re prefixed by the config id.
[xmlrouter]
/
impl
/
src
/
main
/
java
/
org
/
wamblee
/
xmlrouter
/
impl
/
CompositeConfig.java
diff --git
a/impl/src/main/java/org/wamblee/xmlrouter/impl/CompositeConfig.java
b/impl/src/main/java/org/wamblee/xmlrouter/impl/CompositeConfig.java
index b378052c207b05015b78d427870070c733e7dcbf..56e3e8b3f7cb799f77e23d68c42a43b2b1a69864 100644
(file)
--- a/
impl/src/main/java/org/wamblee/xmlrouter/impl/CompositeConfig.java
+++ b/
impl/src/main/java/org/wamblee/xmlrouter/impl/CompositeConfig.java
@@
-15,28
+15,44
@@
*/
package org.wamblee.xmlrouter.impl;
*/
package org.wamblee.xmlrouter.impl;
-import java.util.
LinkedHashMap
;
-import java.util.
Map
;
+import java.util.
ArrayList
;
+import java.util.
List
;
import org.wamblee.xmlrouter.common.Id;
import org.wamblee.xmlrouter.config.Config;
import org.wamblee.xmlrouter.common.Id;
import org.wamblee.xmlrouter.config.Config;
+/**
+ * Composite config. The composite config
+ *
+ * @author Erik Brakkee
+ *
+ * @param <T>
+ */
public class CompositeConfig<T> implements ExtendedConfig<T> {
public class CompositeConfig<T> implements ExtendedConfig<T> {
- private Map<Id<T>, T> configs;
+ private Id<Config> id;
+ private List<T> configs;
- public CompositeConfig() {
- configs = new LinkedHashMap<Id<T>, T>();
+ public CompositeConfig(Id<Config> aId) {
+ id = aId;
+ configs = new ArrayList<T>();
+ }
+
+ @Override
+ public Id<Config> getId() {
+ // TODO test id.
+ return id;
}
public void add(Config<T> aConfig) {
}
public void add(Config<T> aConfig) {
- for (Id<T> id : aConfig.map().keySet()) {
- configs.put(id, aConfig.map().get(id));
+ // TODO check duplicate config.
+ for (T item : aConfig.values()) {
+ configs.add(item);
}
}
@Override
}
}
@Override
- public
Map<Id<T>, T> map
() {
+ public
List<T> values
() {
return configs;
}
return configs;
}
@@
-46,13
+62,12
@@
public class CompositeConfig<T> implements ExtendedConfig<T> {
return false;
}
return false;
}
- private void notSupported() {
- throw new RuntimeException("readonly instance");
- }
-
@Override
@Override
- public
Id<T>
add(T aT) {
+ public
void
add(T aT) {
notSupported();
notSupported();
- return null;
+ }
+
+ private void notSupported() {
+ throw new RuntimeException("readonly instance");
}
}
}
}