Hi again again,
I have worked out a third and hopefully refactoring of the classes and
interfaces for dependency injection. Unsurprisingly (but most
appreciated) things got simpler with every refactoring.
Things are now reduced to a Dependency interface and a
DependencyInjector class. The latter is a general purpose class to
perform dependency injection (CBDI and SBDI) so I also created a
HiveMind specific ServiceInjector (using the DependencyInjector) which
in addition will autowire services.
public interface Dependency
{
public static final String CBDI_TYPE = "CBDI";
public static final String SBDI_TYPE = "SBDI";
public boolean supportsInjectionType(String injectionType);
public boolean isRequired();
public boolean isAssignableToType(Class type);
public String getTargetProperty();
public Object getValueAs(Class type);
}
public class DependencyInjector
{
public Object createInstance(Class clazz, Dependency[] deps) {...}
public void injectDepedencies(Object object, Dependency[] deps) {...}
}
public class ServiceInjector
{
public Object createInstance(Class clazz) {...}
public Object createInstance(Class clazz, Dependency[] additionalDeps) {...}
public void injectServices(Object object) {...}
public void injectServices(Object object, Dependency[] additionalDeps) {...}
}
Does this look like it's ready to be integrated into HiveMind? Other thoughts?
--knut
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]