On Feb 9, 2010, at 12:43 PM, Evan Gilbert wrote: > Trying to solve a use case in Guice that's similar to Robot Legs, but the > existing solutions don't seem to map. > > Use case (code below): > - Have an existing Robot class with @Injected constructor that takes a > RobotHeart > - Have existing RobotModule that provides a set of bindings for robot parts, > including a binding for RobotHeart > - Can't modify RobotModule or Robot > - I want to be able to inject a Robot instance with a different RobotHeart > binding, i.e. > @Inject @TitaniumHeart Robot; > creates a robot with a different injected heart. > > The PrivateModule solution doesn't seem to work, because it would create a > duplicate key for RobotHeart.class and duplicate keys aren't allowed. > > Any thoughts on how to implement?
Doesn't subclassing work? What issues are you having with that type of solution? -bp -- 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.
