I am pretty new to Guice and have been trying to see if my problem is solvable with Guice. I have a main Driver class which looks like this :
public class Driver{
execute(){
Manager m = injector.getInstance(Manager.class);
}
}
public class Manager{
private List<IExecutor> executors;
@Inject
public Manager(IExecutorWrapper executor){
this.executors = executor.getExecutors();
}
public List<IExecutor> getExecutors() {
return executors;
}
}
My IExecutorWrapper class has multiple implementations, each giving its own list of IExecutors. Only 1 is chosen at runtime, the logic to choose which implementation depends on a context. Whats the best way to design this such that my Driver class doesn't need to change ? How will my GuiceModule look like ?
Thanks !