Perhaps you can inject the service using field or setter injection so that you don't break the existing functionality.
On Wed, Apr 28, 2010 at 11:05 PM, senny <[email protected]> wrote: > Hi, > > We are currently integrating Guice into an existing Project. Most of > the Objects are created via the Guice Injector and work fine but there > is a case where I dont know the right way to Refactor it. We have the > following Situation: > > public class Country { > public static final Country SWITZERLAND = new Country(123); > public static final Country GERMANY = new Country(456); > > private Integer _internalCountryCode; > > public Country(Integer internalCountryCode) { > _internalCountryCode = internalCountryCode; > } > > public String getTranslation() { > //I need a Service from Guice to perform the translation > } > > } > > The problem is that of course the static Country instances do not get > created by Guice and so I cant inject the necessary service to > translate into the objects. Is there a way to refactor that code to > make it more guicey? > > Cheers, > -- Yves > > -- > 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]<google-guice%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-guice?hl=en. > > -- 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.
