git://wamblee.org
/
xmlrouter
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
id prefixes are now done at the very last moment instead of when an item is added.
[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 c9e250e49824fa44272aa3f1addd919f74871c09..0c6100dc3fc82c2c9a4484bc2af21e258e84d7a0 100644
(file)
--- a/
impl/src/main/java/org/wamblee/xmlrouter/impl/CompositeConfig.java
+++ b/
impl/src/main/java/org/wamblee/xmlrouter/impl/CompositeConfig.java
@@
-39,16
+39,24
@@
public class CompositeConfig<T extends Identifiable<T>> implements
private static final Id<Config> ID = new Id<Config>("compositeconfig");
private static final String READ_ONLY_INSTANCE = "read only instance";
private static final Id<Config> ID = new Id<Config>("compositeconfig");
private static final String READ_ONLY_INSTANCE = "read only instance";
+
+ private Class<T> type;
private Set<Id<Config>> ids;
private List<Id<T>> valueIds;
private List<T> values;
private Set<Id<Config>> ids;
private List<Id<T>> valueIds;
private List<T> values;
- public CompositeConfig() {
+ public CompositeConfig(Class<T> aType) {
+ type = aType;
ids = new HashSet<Id<Config>>();
valueIds = new ArrayList<Id<T>>();
values = new ArrayList<T>();
}
ids = new HashSet<Id<Config>>();
valueIds = new ArrayList<Id<T>>();
values = new ArrayList<T>();
}
+ @Override
+ public Class<T> getType() {
+ return type;
+ }
+
@Override
public Id<Config> getId() {
return ID;
@Override
public Id<Config> getId() {
return ID;
@@
-60,17
+68,22
@@
public class CompositeConfig<T extends Identifiable<T>> implements
throw new ConfigException("duplicate id '" +
aConfig.getId().toString() + "'");
}
throw new ConfigException("duplicate id '" +
aConfig.getId().toString() + "'");
}
+ String prefix = aConfig.getId().getId() + ".";
for (T item : aConfig.values()) {
for (T item : aConfig.values()) {
- if (valueIds.contains(item.getId())) {
+ Id<T> newId = new Id<T>(prefix + item.getId());
+ if (valueIds.contains(newId)) {
throw new ConfigException("duplicate id '" +
item.getId().toString() + "'");
}
}
ids.add(aConfig.getId());
throw new ConfigException("duplicate id '" +
item.getId().toString() + "'");
}
}
ids.add(aConfig.getId());
+
for (T item : aConfig.values()) {
for (T item : aConfig.values()) {
- valueIds.add(item.getId());
- values.add(item);
+ Id<T> newId = new Id<T>(prefix + item.getId());
+ valueIds.add(newId);
+ values.add(IdentifiablePrefixProxyFactory.getProxy(prefix, item,
+ Identifiable.class, aConfig.getType()));
}
}
}
}