System.getProperty(String)
call, that retrieves a number of the java runtime environment. For example, the method call System.getProperty("user.dir")
, returns the current working directory.The problem? If the String literal which is used as key is not correct, the error is very difficult to be found. To address this problem i thought a solution using enumerations (I am not sure its the most elegant solution, but i like it :) ).
The class SystemProperties and the enum Properties comprise my solution to the problem. The error-prone code is written only once in Properties enum, and in the rest of the program you can use the type safe container, defined in SystemProperties class. Can this be the Configuration Pattern? ... just kidding :).