- public ConfigImpl(AtomicLong aNext) {
- dirty = false;
- next = aNext;
- registered = new LinkedHashMap<Id<T>, T>();
+ public ConfigImpl(Class<T> aType, Id<Config> aId) {
+ notNull("type", aType);
+ notNull("id", aId);
+ type = aType;
+ id = aId;
+ registered = new HashMap<Id<T>, T>();
+ }
+
+ @Override
+ public Class<T> getType() {
+ return type;
+ }
+
+ /**
+ * Copies the config object.
+ *
+ * @param aConfig
+ * Config to copy.
+ */
+ public ConfigImpl(ConfigImpl<T> aConfig) {
+ notNull("config", aConfig);
+ id = aConfig.id;
+ registered = new HashMap<Id<T>, T>();
+ for (Map.Entry<Id<T>, T> entry : aConfig.registered.entrySet()) {
+ registered.put(entry.getKey(), entry.getValue());
+ }
+ }
+
+ @Override
+ public Id<Config> getId() {
+ return id;