If you use the Class class (don't you love it ) Class myC = new Class("WhateverClass"); Then you can use the methods of Class to get at some MetaData. For instance: Field[] classFields = myC.getFields();
"JavaRanch, where the deer and the Certified play" - David O'Meara
Marium Hasan
Greenhorn
Joined: Oct 03, 2001
Posts: 12
posted
0
Can we get on fields( variables ) as well as Methods ( static & non-static ) by exploring Class class methods & using Field class array.?
Originally posted by Cindy Glass: If you use the Class class (don't you love it ) Class myC = new Class("WhateverClass"); Then you can use the methods of Class to get at some MetaData. For instance: Field[] classFields = myC.getFields();
There doesn't seem to be a class called "metaclass". The "Class" class Cindy refered to lives in java.lang
Can we get on fields( variables )
If you are asking if you can get the names of variables the class "Class" has a method called "getFields()" which is defined as "Returns an array containing Field objects reflecting all the accessible public fields of the class or interface represented by this Class object."
as well as Methods
That same class has a method called "getMethods()" which looks like what you want.
Please ignore post, I have no idea what I am talking about.
Marium Hasan
Greenhorn
Joined: Oct 03, 2001
Posts: 12
posted
0
Thanks Christopher and Cindy for your great help! With Regards Marium