Posts

Under Construction

Under Construction

Under Construction

Under Construction

Under progress

This blog is under construction.

Under development

This blog is under development.

Blog Under Construction...

Blog Under Construction...

Java Reflections-Reloaded

Coming Soon.....

JAVA Reflection API - An Example to invoke fields

Image
Assume that we have 50 Java Bean classes with each class having atleast 5 fields with getter/setter methods. Now its time for you to debug the contents of each object. So how do we have to debug all these classes? - Implement a toString() method inside each class. - Create a StringBuilder/StringBuffer object inside the toString() method. - Append each and every field present inside the class to buider/buffer object in the toString() method, and    then return this object by converting it into a String. - This process translates the object into a well-defined understandable textual format. Well, this is really a good process, but, keeping in mind that we have tens of classes resulting in hundreds of variables, how long do you think it'd take to debug all our classes. I bet this process sucks big time So,What is the alternative???? Lets get into programming for a while. Class-1: RootObject.java package com.devonline.reflec.samples; import java.io.Serializable;...