Inactive

Project Summary

  Analyzed 9 days ago based on code collected 9 days ago.

Status: proof of concept, seeking Feedback

"Here's one I made earlier."

Hoime aims to simplify the use of existing dependency injection frameworks by eliminating explicit injection code. This is achieved by weaving injection requests into object constructors as required.

The goal is to move from this:

Injector injector = ...
Greeter g = new Greeter("Richard");
injector.injectMembers(g);
assertEquals("Hello Richard", g.getText());to this:

Greeter g = new Greeter("Richard");
assertEquals("Hello Richard", g.getText());Basic usage is as follows.

Determine which classes to include/exclude from transparent injection, before any injectable classes have been loaded:

InjectionContext.setIncludedClasses("hoime.guice.**");Configure the dependency injection framework you are using, Guice in this case.

Module module = new AbstractModule() {
protected void configure() {
bind(String.class).toInstance("Moshimoshi");
}
};
Injector injector = Guice.createInjector(module);Attach it to hoime:

InjectionContext.setInjector(new GuiceInjector(injector));Start using your transparently injected objects:

String greeting = new Greeter("Richard").getText();
assertEquals("Moshimoshi Richard", greeting);Now run your application, passing in the hoime jar as a javaagent:

java -javaagent:hoime-1.0.jar ...Currently there is support for Guice, Spring and Pico dependency injection. Constructor injection is not supported. See test suites for examples.

Share

In a Nutshell, hoime...

 

Activity

30 Day Summary Apr 10 2013 — May 10 2013

12 Month Summary May 10 2012 — May 10 2013

Community

Ratings

Be the first to rate this project
 
Click to add your rating
 
Review this Project!
 
 
 

Creative Commons License Copyright © 2013 Black Duck Software, Inc. and its contributors, Some Rights Reserved. Unless otherwise marked, this work is licensed under a Creative Commons Attribution 3.0 Unported License . Ohloh ® and the Ohloh logo are trademarks of Black Duck Software, Inc. in the United States and/or other jurisdictions. All other trademarks are the property of their respective holders.