> i haven't applied your patch for a couple of reasons: > 1. i'd prefer to solve the more general problem of being able to > introspect interfaces rather than implementations
Sounds good :) > hopefully the code i've committed will provide an alternative solution. > you'll need to do a little more work outside the betwixt code something > like: ... > hope this solves your problem. Yes, it does. And it's a clean solution. Thanks a lot! regards Christoph > > - robert > > On Friday, August 29, 2003, at 01:17 AM, Christoph Gaffga wrote: > > > hi, > > > >>> I've implemented a way to customize the serialization of EJBs through > >>> dot-betwixt-files. > >>> My solution looks up the dot-betwixt-file if the class to serialize is > >>> a > >>> Proxy. I only changed some lines in XMLIntrospector.findByXMLDescriptor. > > > > and here is the patch for it. I hope it finds it way into the betrixt > > codebase. > > I found it very usefull as it doesn't realy make sense to serialize the > > proxy class (perheaps it makes sense to serialize the remote handle in > > some > > cases). > > > >>> - How/Where can I change behavior to use the interface-Description > > instead > >>> of the classes one if no dot-betwixt-file ist found? > > > > this issue I haven't solved yet. > > > >> 3. please don't lose enthusiasm if it takes a while for the patch to get > >> committed. > > > > Sure, but please let me know, if you reject it, and why. Or in favor of > > witch solution. > > > >> but i'm trying to be careful about the design and get it right (this > > time). > > > > Yeah, and you did a great job. I realy like, what betwix does. > > > > regards > > Christoph ([EMAIL PROTECTED]) > > > > cvs diff -u XMLIntrospector.java > > Index: XMLIntrospector.java > > =================================================================== > > RCS file: > > /home/cvspublic/jakarta- > > commons/betwixt/src/java/org/apache/commons/betwixt/ > > XMLIntrospector.java,v > > retrieving revision 1.23 > > diff -u -w -b -B -r1.23 XMLIntrospector.java > > --- XMLIntrospector.java 27 Jul 2003 18:47:39 -0000 1.23 > > +++ XMLIntrospector.java 28 Aug 2003 23:54:45 -0000 > > @@ -61,6 +61,7 @@ > > import java.beans.IntrospectionException; > > import java.beans.Introspector; > > import java.beans.PropertyDescriptor; > > +import java.lang.reflect.Proxy; > > import java.net.URL; > > import java.util.ArrayList; > > import java.util.List; > > @@ -735,21 +736,29 @@ > > * Attempt to lookup the XML descriptor for the given class using the > > * classname + ".betwixt" using the same ClassLoader used to load the > > class > > * or return null if it could not be loaded > > + * If <code>aClass</code> is a Proxy use the first interface instead. > > * > > * @param aClass digester .betwixt file for this class > > * @return XMLBeanInfo digested from the .betwixt file if one can be > > found. > > * Otherwise null. > > */ > > protected synchronized XMLBeanInfo findByXMLDescriptor( Class aClass > > ) > > { > > + Class showClass = aClass; > > + > > + // If the class is a Proxy, use the interface > > + if ( Proxy.isProxyClass(aClass) && aClass.getInterfaces().length > > > > > 0 ) { > > + showClass = aClass.getInterfaces()[0]; > > + } > > + > > // trim the package name > > - String name = aClass.getName(); > > + String name = showClass.getName(); > > int idx = name.lastIndexOf( '.' ); > > if ( idx >= 0 ) { > > name = name.substring( idx + 1 ); > > } > > name += ".betwixt"; > > > > - URL url = aClass.getResource( name ); > > + URL url = showClass.getResource( name ); > > if ( url != null ) { > > try { > > String urlText = url.toString(); > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]