i have a method as follows.
test(Object obj){
}
now within this method i want to get all fileds along with the datatypes of those fileds. How can i do that??
i have a method as follows.
test(Object obj){
}
now within this method i want to get all fileds along with the datatypes of those fileds. How can i do that??
As Omry suggested, you need to use Reflection. Link 1Link 2
Using reflection is very resource intensive, violates almost all OOP principles and should be avoided unless really needed. It can get very nasty when you start accessing private data members/methods and violating the presentation invariants of the objects you're inspecting. Might i suggest using the instanceof operator to find out if your object is of a particular class and going from there?