Originally posted by Ashok Kumar Babu:
Please cache the fields. PLEASE! Now you retrieve all fields twice times the number of fields!
So instead:
Now a huge error in your code:
And what if the field indicates an int[], or boolean[]? ClassCastException!
That's why you need getComponentType as well:
Fortunately, java.lang.reflect.Array can help you out without all these checks:
element will be Integer, Boolean etc for primitive type arrays.
[ September 23, 2008: Message edited by: Rob Prime ]