Thanks Rickard for looking into this.
When you say "got generic lookups like this to work.." you refer to 2.0 branch 
status, correct ?

As of now, I think the most necessary work is on the "registering a generic 
service" side.
To write it up like what I know in Guice (with all the clutter I personally 
don't like):
bind(new TypeLiteral<Foo<Bar>>(){}).to(X);

As of 2.0 branch, looking into it as I think this is crucial when considering 
Qi4J, next to its strong DDD focus also as a valuable DI framework. 

I would see ( maybe a future version of ) qi4j as a superset of DI frameworks. 

- or would you say that pure DI frameworks (mostly familiar with Guice) are by 
concept superior to qi4j in its domain and you shoult never attempt to think 
"guice" in qi4j ?


Toni Menzel   
Consultant | ISG Technology   
Morgan Stanley Bank AG | Junghofstrasse 13-15 | Floor 0G   
60311 Frankfurt   
Phone: +49 69 2166-2103   
[email protected]   

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Rickard Öberg
Sent: Wednesday, June 29, 2011 8:45 AM
To: [email protected]
Subject: Re: [qi4j-dev] Generic Services in Qi4J ?

Ok, followup to previous response. After a little tinkering I got generic 
lookups like this to work as well:
@Service
Foo<T> fooService;

As long as the actual mixin/object that needs the injection has resolved T 
(e.x. to String), the Qi4j runtime can figure this out and inject String 
instead of T.

Example:
public abstract class AbstractFooMixin<T> {
   @Service Foo<T> fooService;
}

public class FooMixin
   extends AbstractFooMixin<String>
{}

If FooMixin is used, then T can be resolved to String, and so injection of the 
Foo<String> service works properly.

/Rickard

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

--------------------------------------------------------------------------
NOTICE: If received in error, please destroy and notify sender. Sender does not 
intend to waive confidentiality or privilege. Use of this email is prohibited 
when received in error.
 
Morgan Stanley Bank AG
Junghofstrasse 13-15
60311 Frankfurt
 
Vorstand: Dr. Dirk Notheis, Vorsitzender; Philipp Lingnau; Dr. Hanns Christoph 
Siebold; Kai Tschöke
Vorsitzender des Aufsichtsrats: Dr. Lutz R. Raettig 
Sitz Frankfurt am Main, Handelsregister Frankfurt am Main HR B 39346

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to