private member access

Hi !

I have a class in which there are some private and some public data members. I want to get the name of each data member ( public as well as private ) along with its data type in order to put this information in vector. Vector is in the same class.

how can I do this? does ne 1 know the ans?

-Vaibhav.

[339 byte] By [v_sanas] at [2007-9-26 20:47:18]
# 1
Hi, Check out the java.lang.reflect package.Reflection allows you to have info about the fields , methods , constructors of a loaded class .Hope this helps,Manish
Manish21 at 2007-7-3 19:36:18 > top of Java-index,Archived Forums,Portability & Platform Independence [Archive]...
# 2
java.lang.Class contains methos for accessing the field names. The method is your classname.getClass().getDeclaredField(String name) This method return a field object.For getting the type, Above FieldObject.getType() returns the type of your field.
cini_gm at 2007-7-3 19:36:18 > top of Java-index,Archived Forums,Portability & Platform Independence [Archive]...
# 3
Cross post http://forum.java.sun.com/thread.jsp?thread=220434&forum=31&message=770997
jschell at 2007-7-3 19:36:18 > top of Java-index,Archived Forums,Portability & Platform Independence [Archive]...