Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<b></b>hi,
i have function getValues(Object object) which perform some operation. and run time i can pass any object to it. I have to access public fields of that object with there values.
so how to do this?

Thanks,
pankaj
Posted

You can do this by using java Reflection.
 
Share this answer
 
Comments
pankaj hingane 15-Feb-13 2:08am    
using java reflection i can access field name but how to access field value?
using java reflection i can access field name but how to access field value?
 
Share this answer
 
If you get the field then you can get the field value easily.
Here is some example Try this
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900