*/
package org.wamblee.system.adapters;
+import org.wamblee.system.container.Container;
import org.wamblee.system.core.Component;
-import org.wamblee.system.core.Container;
import org.wamblee.system.core.ProvidedInterface;
import org.wamblee.system.core.RequiredInterface;
super.addComponent(aComponent);
return this;
}
-
- public DefaultContainer addComponent(String aName, Class aClass) {
- return addComponent(new ClassAdapter(aName, new ClassConfiguration(
- aClass)));
- }
public DefaultContainer addComponent(String aName, ClassConfiguration aConfiguration) {
return addComponent(new ClassAdapter(aName, aConfiguration));
}
+ public DefaultContainer addComponent(String aName, Object aObject, ObjectConfiguration aConfiguration) {
+ if ( !aConfiguration.appliesTo(aObject) ) {
+ throw new IllegalArgumentException("Configuration '" + aConfiguration + "' does nto applu to '" +
+ aObject + "'");
+ }
+ return addComponent(new ObjectAdapter(aName, aObject, aConfiguration));
+ }
+
+
@Override
public DefaultContainer addRequiredInterface(RequiredInterface aRequired) {
super.addRequiredInterface(aRequired);