The easiest way would be to do this with GIN and a provider method. I'm not sure what the <when-property-is name="alerter" value="goodbye">, so I could be off base here, but here is a way to do it.
@Inject @Provides public MyResources getMyResources(MyResources hello, GoodByeResources goodBye, Alerter alerter){ if(alerter.equals("hello")){ return hello; }else if(alerter.equals("goodbye")){ return goodBye; } } Also, MyResources needs to extend ClientBundle, and then by extendsion GoodByResources automatically does. Then you can just @Inject MyResources and it will make the decsion as to which resource bundle to return. On Nov 9, 11:13 am, Thalles <henry.rotz...@googlemail.com> wrote: > Hello group, > > I've just got a quick question. Is it possible to do deferred binding > with interfaces? > Background: I would like to change the client bundle or constants > interfaces, depending on the user. > The problem is, that the client bundle or constants implementation has > to be an interface itself. > > I've tried to implement it, but it always says "Deferred binding > result type <classname> should not be abstract" > > This is my general class, that should be replaced: > public interface MyResources > { > public static final MyResources INSTANCE = > GWT.create(MyResources.class); > > CssResource css(); > TextResource getSynchronousTextResource(); > ExternalTextResource getAsynchronousTextResource(); > ImageResource getDLRLogo(); > > } > > Here is one of implementations > public interface GoodByeResources extends ClientBundle, MyResources { > public static final GoodByeResources INSTANCE = > GWT.create(GoodByeResources.class); > > @Source("files/test.css") > CssResource css(); > > @Source("files/test1.txt") > TextResource getSynchronousTextResource(); > > @Source("files/test2.txt") > ExternalTextResource getAsynchronousTextResource(); > > @Source("files/dlk.jpeg") > ImageResource getDLKLogo(); > > } > > Here is a usage example: > ImageWindow cmdw = new ImageWindow(myConstants.caption(), > MyResources.INSTANCE.getDLKLogo()); > > And this is my configuration: > <replace-with class="gwt.map.client.constantstest.HelloResources"> > <when-type-is class=gwt.map.client.constantstest.MyResources"/> > <when-property-is name="alerter" value="hello"/> > </replace-with> > > <replace-with class="gwt.map.client.constantstest.GoodByeResources"> > <when-type-is class="gwt.map.client.constantstest.MyResources"/> > <when-property-is name="alerter" value="goodbye"/> > </replace-with> > > Is there any way, I could do this? Maybe a concrete class with an > inner interface? > Can I inject interfaces with GIN? > > Thanks in advance! > > Bye Thalles -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.