Thank you very much.
In fact, I tried this before I posted the question.
But it just can't get the values ???? (only display the null value) !!!
Did you tried it ??
Eric
----- Original Message -----
From: "Yasir Siraj" <[EMAIL PROTECTED]>
To: "BCEL Users List" <[EMAIL PROTECTED]>; "Eric Chow"
<[EMAIL PROTECTED]>
Sent: Wednesday, June 30, 2004 5:24 PM
Subject: Re: Retrieve all the values of variables in the class ?
> Here's an example.
>
> public void test() {
> JavaClass jClass;
> ConstantPool cp;
> ConstantPoolGen cpg;
> jClass = new ClassParser("HelloWorld.class").parse();
> cp = jClass.getConstantPool();
> cpg = new ConstantPoolGen(cp);
> String className = jClass.getClassName();
> Method methods[] = jClass.getMethods();
> Field fields[] = jClass.getFields();
> for (int i = 0; i < fields.length; i++) {
> System.out.println(fields[i].getName());
> System.out.println(fields[i].getConstantValue);
> }
> for (int j = 0; j < methods.length; j++) {
> MethodGen mg = new MethodGen(methods[j], className,
> cpg);
> LocalVariableGen vGen[] = mg.getLocalVariables();
> for (int k = 0; k < vGen.length; k++) {
> System.out.println(vGen[k].getName());
> }
> }
> }
>
> I hope now, u'll get the idea on how to do things..
>
> Regards.
> Yasir Siraj.
> IMP-DCS
> Chalmers University Of Technology
> Goteborg, Sweden.
>
>
> =====
>
> Regards.
>
> Yasir Siraj.
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - 100MB free storage!
> http://promotions.yahoo.com/new_mail
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]