I want to use an Enum in Java for storing configuration values for different environments. Each Enum will have the same fields, but different values. Something like:
public enum DevelopmentConfig
{
URL("..."),
defaultURL(".....");
}
public enum ProductionConfig
{
URL("..."),
defaultURL(".....");
}
This is for a web application, so I can't simply use Preferences or any other solution.
My question is, is there a way to create an interface to define the fields of the configuration? Or should I be using a normal class instead of enum for storing these values?
Edit: To use this, I simply want to do this from my other classes:
String url = Config.URL
Or
String url = Config.getURL();
Without knowing if that refers to Config.Development or Config.Production (I want that to be determined in the Config enum's constructor itself and have it choose the right set of fields)