commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <>
Subject Re: [betwixt] Howto serialize the classname when writing XML
Date Mon, 27 Sep 2004 21:51:12 GMT
On 26 Sep 2004, at 18:59, Christoph Gaffga wrote:

> 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.

yep. it's on the todo...

> 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)).

a concrete example would be useful (so i'm sure i understand you 

(i'm guessing that you want to map a com.example.SomeException class to 
xml which looks something like:

	<message>Mysterious problem</message>

> 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.

that's true.

this is related to the derived beans stuff i've been looking at 
recently. i should really add support for writing types (so that 
betwixt supports round tripping for simple attribute typed derived 
beans) so i'll probably take a look at coding this up sometime soonish. 
but it's important that i understand your use case so i make that i 
cover it.


> 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.

so, you'll need a coursely grained pluggable strategy. probably also 
want to be able to  override in a betwixt file but that seem like it's 
a secondary priority.

> 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.

i'm happy to take a look at coding this up but i other pots on the boil 
right now so it might take a few days...

- robert

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message