Open minds leads to freedom

Communicating my thoughts on software development

Search Results

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 […]

Read the rest of this post...

Posted in Uncategorized | 1 Comment »

JDK7 Tackles Java Verbosity

Posted on Tuesday, September 22nd, 2009

Tweet Interesting article showing some changes on the Java platform to address its verbosity, but keeping code readability safe. I liked the new Collection’s literals syntax to create lists, sets and maps: List powersOf2 = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024}; Map ages = {“John” : 35, “Mary” : 28, […]

Read the rest of this post...

Posted in Uncategorized | 2 Comments »