I have a factory class that serves out a bunch of properties.
Now, the properties might come either from a database or from a properties file.
This is what I've come up with.
public class Factory {
private static final INSTANCE = new Factory(source);
private Factory(DbSource source) {
// read from db, save properties
}
private Factory(FileSource source) {
// read from file, save properties
}
// getInstance() and getProperties() here
}
What's a clean way of switching between these behaviors based on the environment. I want to avoid having to recompile the class each time.