This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
As a small example, from a factory that loads the classname to be loaded from a properties file based on a key handed in by the calling class:
handlers is a Properties Object loaded from a ResourceBundle. handlerName is a String serving as a key into the ResourceBundle. AbstractHandler is an abstract baseclass to all Objects that I expect to be able to load here (as the factory after creation calls an initialisation method on the created Object before returning it). I devised this system to reduce the humongous length of some of our code (servlet classes consisting of 3000+ lines of code in a single unit) and split it up in smaller functional chunks. This (apart from some basic code to initialise the passed parameters and errorchecking) is now all that remains of some 1500 lines in one class: