2008/11/1 Todor Boev <[EMAIL PROTECTED]>

> clement escoffier wrote:
>
> > That is not directly possible. However, you can do this as following:
> > public class ConsumerImpl {
> >     // Temporal dependency on FooService
> >     FooService fs;
> >
> >     // An helper object
> >     ConsumerHelper helper;
> >
> >
> >     public ConsumerImpl() {
> >         helper = new ConsumerHelper(new FooService() {
> >             public void doSomething() {
> >                 System.out.println("Delegate on fs");
> >                 // Use the temporal dependency
> >                 fs.doSomething();
> >             }
> >         });
> >
> >     }
> > }
> >
> > So, you create a kind of smart proxy delegating on  the temporal
> dependency
> > (on regular dependency). By doing this:
> > - The helper object inherits of the dependency behavior
> > (default-implementation, nullable ...)
> > - You can control the delegation policy
>
> According to this FAQ item:
>
>
> http://felix.apache.org/site/accessing-services-inside-inner-and-anonymous-classes.html
>
> I need to have a getter method, which the smart proxy must call and than
> delegate to the returned
> instance. Otherwise I will jump over all the nice instrumentation iPojo has
> added for the
> "FooService fs;" field. Is this FAQ still valid or does iPojo now
> instrument the inner classes as
> well? (I certainly hope it does :)


This is a major improvement of the 1.0.0 version. Now, iPOJO is able to
inject fields inside inner and nested classes. The FAQ entry is not up to
date, and I'm going to fix it right now :)


Regards,

Clement



> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to