hivemind-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Wannheden <>
Subject Re: reusable dependency injection
Date Wed, 02 Mar 2005 15:49:24 GMT
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?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message