I have a list of actions implementing the Action interface.
FooAction implements Action
BarAction implements Action
I want to be able to process each action in a List :-
List<Action> actions = new ArrayList<Action>;
..
for( Action action : actions)
action.process();
Is it possible to get Guice (or spring !) to inject all the individual Actions into the actions list ? I know I can write code to manually create a set like this :-
Multibinder<Action> actionBinder = Multibinder.newSetBinder(binder(), Action.class);
actionBinder.addBinding().to( FooAction.class );
actionBinder.addBinding().to( BarAction.class );
But it would be nice if I could write new action classes that are picked up automatically and injected into my list? or is this just wishful thinking.