Google GIN AbstractGinModule & GWT.Create ()

I have a class that extends AbstractGinModule

as:

public class ClientModule extends AbstractGinModule { public ClientModule() { } @Override protected void configure() { ... ... bind(...class).annotatedWith(...).to(...class).in(Singleton.class); ... } } 

The idea that I have is to associate one class with another class based on the value stored in the properties file.

as:

param contains the value coming from the properties file

 if(param.equals("instanceB")) bind(a.class).to(b.class) else bind(a.class).to(c.class) 

I have a class that accesses this properties file and returns a string with a value. This class is called: InstanceParameters.java

I would like to get an instance of this class in my ClientModule. But I find no way to do this. I tried:

 - InstanceParameters param = new InstanceParameters (); - GWT.create(InstanceParameters.class); (Error because this method should only be used on the client side) 

Is there a way to access this InstanceParameters class in this client module?

thanks for the help

+4
source share
1 answer

You do not need to read the file before running the application - before creating the AbstractGinModule (via GWT.create ). So, load the Dictionary into your onModuleLoad method and pass the parameters as a whole to InstanceParameters , or as an extracted string, through a provider or any other means.

+1
source

All Articles