I am wondering if it is possible to accomplish the following using EJB3.
I have the following interface:
interface DateParser {
Date parseDate(String input);
String getType();
}
Then I have several implementations of said interface that handle different formats based on the information given in the getType method. When my bean starts up it creates a Set of implementations of DateParser and when it needs to parse a date, it iterates over the set to see which one matches. If one matches it uses that one to parse the date. If none match, then it applies a default strategy. I would like to get away from instantiating these delegates because every time I add a new strategy it requires a code change in the bean making it a huge mess.
I would much prefer to have the container inject all of the implementations it finds at deployment. Is there a reasonable way to accomplish this?
Thanks