Question regarding CGLIB

View: New views
2 Messages — Rating Filter:   Alert me  

Question regarding CGLIB

by Vinicius Carvalho :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello there! First of all, thanks, really cool project. This project
is really helping me a lot. I have a simple question regarding CGLIB,
couldn't find any resource out there, hope I get help here :)

I'm using the Decorating Toy. I need to create a proxy around a
concrete class (hence I'm using CglibProxyFactory). Insinde my
beforeMethodStarts method I need to iterate through the  member
variables of the original class using clazz.getDeclaredFields().
Problem is I'm getting a reference to the Enhanced version not the
ones at the class, and my code is not working.

Is it possible to access the original members through that?

Regards

--
JBoss Certified Advanced J2EE Developer
IBM Certified SOA Solution Designer
IBM Database Associate - DB2 UDB V8.1 Family
Sun Certified Enterprise Architect (Part I)

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Question regarding CGLIB

by Jörg Schaible-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Vinicius,

Vinicius Carvalho wrote:

> Hello there! First of all, thanks, really cool project. This project
> is really helping me a lot. I have a simple question regarding CGLIB,
> couldn't find any resource out there, hope I get help here :)
>
> I'm using the Decorating Toy. I need to create a proxy around a
> concrete class (hence I'm using CglibProxyFactory). Insinde my
> beforeMethodStarts method I need to iterate through the  member
> variables of the original class using clazz.getDeclaredFields().
> Problem is I'm getting a reference to the Enhanced version not the
> ones at the class, and my code is not working.
>
> Is it possible to access the original members through that?

IIRC CGLIB internally simply derives from the original class. So you might
try to get the parent class and iterator over it's fields.

- Jörg


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email