commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christoph Gaffga" <cgaf...@triplemind.com>
Subject Re: [betwixt] Use interface, if class if proxy
Date Wed, 27 Aug 2003 21:07:42 GMT
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.

    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 = showClass.getName();
        int idx = name.lastIndexOf( '.' );
        if ( idx >= 0 ) {
            name = name.substring( idx + 1 );
        }
        name += ".betwixt";

        URL url = showClass.getResource( name ); // Use showClass
classloader

This works fine.

I have two questions left:

- How/Where can I change behavior to use the interface-Description instead
of the classes one if no dot-betwixt-file ist found?

- Is there any chance to integrate my mechanism into betwixt? Is there
anybody else also interested in such a behavior?

Any respone would be appreciated.

regards
Christoph






Mime
View raw message