ConstructorDefinition<?> ctorDef = componentType.getConstructorDefinition();
Constructor<?> constr = ctorDef.getConstructor();
PojoObjectFactory<?> instanceFactory = new PojoObjectFactory(constr);
configuration.setInstanceFactory(instanceFactory);
configuration.getConstructorParamNames().addAll(ctorDef.getInjectionNames());
SystemAtomicComponentImpl component = new SystemAtomicComponentImpl(definition.getName(), configuration);
// handle properties
Map<String, PropertyValue<?>> propertyValues = definition.getPropertyValues();
processProperties(propertyValues, componentType.getProperties().values(), component);
// handle inbound wires
for (ServiceDefinition serviceDefinition : componentType.getServices().values()) {
Class<?> interfaze = serviceDefinition.getServiceContract().getInterfaceClass();
String name = serviceDefinition.getName();
SystemInboundWire wire = new SystemInboundWireImpl(name, interfaze, component);
component.addInboundWire(wire);
}
// handle references
processReferences(definition, componentType.getReferences(), parent, component);
// FIXME we need a way to build configuration references from autowires in the loader to eliminate this eval
for (ReferenceDefinition reference : componentType.getReferences().values()) {
if (reference.isAutowire()) {
Class interfaze = reference.getServiceContract().getInterfaceClass();
OutboundWire wire =
new SystemOutboundAutowire(reference.getName(), interfaze, parent, reference.isRequired());
component.addOutboundWire(wire);
}
}
return component;
}