Configuration classes with Enums
Posted on Thursday, September 23rd, 2010
Tweet As I mentioned on my previous post, an alternative implementation to create Singleton in Java is with Enum types. Extending the idea, it is interesting to create classes which read configuration values from Properties files with Enum classes. Below is an example: public enum Configuration { HOST(“host”), PORT(“port”), MAIL_SERVER(“mailServer”), INPUT_DIRECTORY(“inputDirectory”), OUTPUT_DIRECTORY(“outputDirectory”); private static Properties [...]
Posted in Uncategorized | 1 Comment »
My LinkedIn