Hi Richard, > > yeah, if Guice doesn't create the instance than there is no way to get > > in the interceptors. > > This is a big disadvantage - is it going to solved in 2.0?
AFAIK: No. This is technically not possible. When you request an instance lets say getInstance(Foo.class) should it need AOP Guice will create a subclass of Foo with the interceptors installed. That is why AOP doesn't work on final classes since they cannot be subclassed. But if you already create an instance there is no way to change class structure of an instance on the fly and put in the interceptors. You're right, delegates are very cumbersome. Yeah, there is no nice solution to this. But to be honest your solution is a bit intimidating:) If it solves your problem I'd call it a day. I'd go a step further and make it more user friend (to use bindInterceptor). With the auto delegates I had this craziness in mind: when you want IFoo but are supplied with new FooImpl, you'd create a delegate class definition for IFoo and ask Guice to provide it (Guice will then subclass it with AOP) and then set the FooImpl to the created delegate and return the delegate. Not for the faint hearted. Cheers, Alen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-guice?hl=en -~----------~----~----~----~------~----~------~--~---
