X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fxmlrouter%2Fimpl%2FConfigImpl.java;h=0e1da0be84853fb6b7690d5ddecfef1f1bd3c3ed;hb=5582d07a1ba9821cc789ea63b71f246e89d13cae;hp=a1733ab41bf84a9b84cb3986f460586871bd763e;hpb=f8027d76e1c3e517a8b80a3476f51adee845fc5b;p=xmlrouter diff --git a/impl/src/main/java/org/wamblee/xmlrouter/impl/ConfigImpl.java b/impl/src/main/java/org/wamblee/xmlrouter/impl/ConfigImpl.java index a1733ab..0e1da0b 100644 --- a/impl/src/main/java/org/wamblee/xmlrouter/impl/ConfigImpl.java +++ b/impl/src/main/java/org/wamblee/xmlrouter/impl/ConfigImpl.java @@ -37,18 +37,41 @@ import org.wamblee.xmlrouter.config.Identifiable; public abstract class ConfigImpl> implements ExtendedConfig { + private Class type; private Id id; private Map, T> registered; /** * Constructs the object. */ - public ConfigImpl(Id aId) { + public ConfigImpl(Class aType, Id aId) { + notNull("type", aType); notNull("id", aId); + type = aType; id = aId; registered = new HashMap, T>(); } + @Override + public Class getType() { + return type; + } + + /** + * Copies the config object. + * + * @param aConfig + * Config to copy. + */ + public ConfigImpl(ConfigImpl aConfig) { + notNull("config", aConfig); + id = aConfig.id; + registered = new HashMap, T>(); + for (Map.Entry, T> entry : aConfig.registered.entrySet()) { + registered.put(entry.getKey(), entry.getValue()); + } + } + @Override public Id getId() { return id;