Two more thoughts: - It's possible to inject the injector (I had to do this in at least one place in our code base). Not as bad as referencing a static injector, but still not optimal. I think we should create the annotation @Inception for this kind of trick.
- In case you missed Christian's message a few days ago, consider defining the factory interface in the same class that it instantiates, in the spirit of "keeping things together". This alleviates the hassle of having to update both your class and your factory signatures when you add @Assisted parameters. -- Cédric -- Cédric On Mon, Nov 12, 2012 at 6:14 PM, Alper Akture <[email protected]>wrote: > Thanks Cedric, I totally agree, I don't like using the injector directly. > I wasn't aware of assisted injection, could be very useful. However, for > many of my classes I have problems with, I give the framework the class > name (in an init method that they call), and they do the instantiation. > Something like this: > > public void initHandlers() { > > addEventHandler(SFSEventType.USER_LOGIN, UserLoginEventHandler.class); > > ... > > } > > And I would need to inject stuff into the UserLoginEventHandler.class. So > I don't think assisted inject can help here, can it? > >> >> -- 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.
