You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-user@jakarta.apache.org by Is...@ny.frb.org on 2003/05/08 20:16:07 UTC
Need help modifying existing class
Hi all. I'm a newbie to BCEL and I'm trying to figure out how to add
fields and methods to an existing class. Can anyone show me a small
example.
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org
RE: Need help modifying existing class
Posted by Bjoern Wuest <bj...@comtec.e-technik.uni-kassel.de>.
Hello
As I am not so experienced with BCEL, I did using the 'FieldGen' and
'MethodGen' classes in the 'org.apache.bcel.classfile' package. To use such
this operations, you need an instance of 'JavaClass'.
I tried to learn BCEL using the excellent BCELifier that you can find in
'org.apache.bcel.util'.
Here is a small example on how to use the BCELifier:
try {
org.apache.bcel.util.ClassLoaderRepository clr = new
org.apache.bcel.util.ClassLoaderRepository(System.class.getClassLoader());
org.apache.bcel.classfile.JavaClass cls =
clr.loadClass("me.you.AndClass");
org.apache.bcel.util.BCELifier bf = new
org.apache.bcel.util.BCELifier(cls, System.out);
bf.start();
} catch (Exception Ex) {
Ex.printStackTrace();
}
Regards
Bjoern
-----Original Message-----
From: Isaac.Goldstein@ny.frb.org [mailto:Isaac.Goldstein@ny.frb.org]
Sent: Donnerstag, 8. Mai 2003 20:16
To: bcel-user@jakarta.apache.org
Subject: Need help modifying existing class
Hi all. I'm a newbie to BCEL and I'm trying to figure out how to add fields
and methods to an existing class. Can anyone show me a small example.
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org