I think the core concept is that guice will help you to create new instances or build relationships between instances by modules that need you to configure, we called this mechanism as 'Injection'. So you can bind whatever int value in some Module classes, then the injector will pick it up when it creates new instances for you.
On Fri, Oct 16, 2009 at 2:20 PM, Gary Pampara <[email protected]> wrote: > > Have a look at assisted injections. > > That will allow you to provide the required int value and let Guice > perform the remainder of the injections. > > On Fri, Oct 16, 2009 at 7:02 AM, sunweiss <[email protected]> wrote: > > > > Hi, > > > > Whats the best way to create a car object in the following scenario > > > > class CarImpl { > > final int horses; > > final Engine engine > > > > public CarImpl(Engine e, int h) {...} > > > > } > > > > > > bind(Engine.class).to(DieselEngine.class); > > bind(Car.class).to(CarImpl.class); //How can i tell my CarImpl to use > > which int? > > > > Another scenario, what if the DieselEngine's constructor looks > > something like this: > > > > class DieselEngine { > > DieselEngine(int volume) {...} > > } > > > > I know, the above class structure might not be the best from an OO > > perspective, im just trying to figure out the best way to use guice. > > > > > > > > > > > > > -- Chinese: http://www.jiakuan.net English: http://www.widenhome.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
