I have a Guice module that has a @Provides method that takes 2 parameters and returns one of the two implementations of an interface
public class ClientModule extends AbstractModule{
@Override
protected void configure(){
}
@Singleton
@Provides
protected ClientInterfaces provideService(Class1 objectOfClass1, String runTimeGeneratedString){
if(condition){
return new firstImplementation();
} else {
return new someImplementation(objectOfClass1, runTimeGeneratedString);
}
}
}
I have seen this question which is almost similar to mine - Passing parameters to Guice @Provides method . But here the OP of this question wants to pass constant String variables to the @Provides method whereas in my case I want to pass a string that will be generated on runtime. How to solve this issue? Any kind of help will be appreciated.
Thank you