commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christoph Gaffga" <cgaf...@triplemind.com>
Subject [betwixt] Howto serialize the classname when writing XML
Date Sun, 26 Sep 2004 17:59:52 GMT
hi,

I have to output some Exception instances to XML using betwixt, but it
doesn't seem to be possible to get the class name into the XML result.

First of all it should output the name of the class only, and not introspect
the whole Class type. This is done well because the type Class is handled as
a primitive type (see
TypeBindingStrategy.Default.isStadardPrimitive(Class)).

But the output of the class name is deactivated in betwixt for whatever
reason and there is no configuration option for turning it on for some
classes, or plugging some custom rules in for that.

I found the following code that omits outputting the class property:

org.apache.commons.betwixt.digester.ElementRule:260
// TODO: ignore class property ??
if ( Class.class.equals( type ) &&
        "class".equals( propertyDescriptor.getName() ) ) {
    log.trace( "Ignoring class property" );
    return;
}

and something similar in:
org.apache.commons.betwixt.digester.AttributeRule:190
org.apache.commons.betwixt.BeanProperty:172


Has somebody any idea how to fix this. I'm don't know much about betwixt to
figure out how to implement a configuration option for this. And, I don't
want to output the class property for all beans, I just want to have it for
all beans derived from java.lang.Throwable.
Does anybody has a hint for me, where to start? I can't get the parent bean
containing the property 'class' in configureProperty(..) method, only
PropertyDescriptor, that does not has a context.

Any help would be apreciated.

regards
Christoph Gaffga
cgaffga@triplemind.com


P.S.:
I also just posted a patch to handle throwable, exceptions and errors as
complex types. Hope it would find it's way into betwixt, see:
http://issues.apache.org/bugzilla/show_bug.cgi?id=31425




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message