jakarta-bcel-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juozas Baliuka" <bali...@centras.lt>
Subject Re: How do you convert a JavaClass to a regular Class object?
Date Sat, 22 Mar 2003 05:45:13 GMT
We use this in cglib without problems on sun jdk implementations,
reflection is used to invoke protected method,
but it is possible to extend ClassLoader and call this method "normal" way
if you do not need  to cast generated classes
or accsess superclass loaded by different classloaders.

> On Fri, 21 Mar 2003 16:51:40 -0500, Berin Loritsch wrote:
>
> > I want to generate a class--and not output a class file.
> > I want to use the class object directly.  Any hints?
>
> I haven't tried this myself, but I believe that you use the defineClass
method of your favourite ClassLoader.  You can get the byte[] required by
the defineClass method from the JavaClass.getBytes method.
>
>            __
>      __   / /\
>     /  /\/ / /_  ------------------------------------
>    /  /  \/ / /\ Mark Crocker
>   /  / /\ \ \/ / mcrocker@markcrocker.com
>  /  /  \_\/\  /  http://www.markcrocker.com/~mcrocker
> /__/ /\ \ \_\/   ------------------------------------
> \  \ \_\/
>  \  \ \
>   \__\/
>
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message