I've read this topic with the instruction about how to use factory pattern
factory pattern dynamic approach
I have this in my factory
public class FilterFactory {
static Map<String, Class> creators;
static {
creators = new HashMap<>();
}
/*...*/
}
And this is one of the classes, which I want to put in the factory
public class ExtentionFilterSerializer implements FilterSerializer {
static {
FilterFactory.creators.put(".", ExtentionFilterSerializer.class);
}
/*...*/
}
When I try to use factory in the program, I see that Map is empty. What did I do wrong?