Reflection is an often esoteric topic in the Java world, but if properly understood and applied to certain circumstances, its learning curve can pay handsome dividends. This blog entry illustrates the use of reflection in the context of Java Beans.
I started using Reflection about a month ago. I was writing a communication library that was parsing over 20 different types of messages. Each message had a Java Bean class. Each of these Beans needed to also include a clone, a good toString, and an equals. Now I could go into each class and create these manually (disgusting, I know). I could also use code generation (which brings up some issues I have about generation, which I’ll discuss later). I decided to use Reflection (surprise!), write each routine once, and have it work for all my Beans. What’s more, it will work for the Beans I am currently using, and all future ones. Not a bad deal and it perfectly supports my lazy agenda.
Read the complete entry: http://spokedweb.com/2007/09/11/avoiding-work-by-using-java-reflection