From: Chris N. <ch...@si...> - 2003-10-23 07:11:18
|
Alef Arendsen (JTeam) wrote: > In a Spring Validator, I'm retrieving the attributes using > BcelAttributes and then inspect the class... Works kind of neat, > > but still, won't this conflict with the ASM way hibernate does things? In short, no. Hibernate uses CGLIB mostly for generating lazy-loading proxies. Since the proxies are subclasses of the mapped classes, you should be able to retrieve your attribute data from the superclass of the proxy. You can tell a proxy from a non proxy by seeing if your object is an instanceof net.sf.cglib.Factory. If a framework ends up using CGLIB or something like it to actually transform your classes at build time or run time you will have to be careful. It is likely that any attributes in the original class would be stripped out. For this reason I would suggest storing the attribute metadata outside of the classfile. Personally I have had good success using QDox to parse the source files, generating a .attributes properties file per class. Chris |