You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Christoph Gaffga (triplemind.com)" <cg...@triplemind.com> on 2004/09/29 21:27:44 UTC

Re: [betwixt] Howto serialize the classname when writing XML

> a concrete example would be useful (so i'm sure i understand you
> correctly)...?
> (i'm guessing that you want to map a com.example.SomeException class to
> xml which looks something like:
> <exception>
> <message>Mysterious problem</message>
> <class>com.example.SomeException<class>
> </exception>)

exactly that was my intention. So: Between <class>...</class> there ist only
a string, the Class is not introspected.
And I need the class-property only in class derived from Throwable, not for
all classes.

For my usecase it would work if there is a switch, in the
IntrospectionConfiguration for example, where I can put the output of
class-property on/off. Then I would turn it on for all and add sumething
like <hide property='class'/> to my dot-betwixt files.

But it would be nicer and more flexible if everybody could plug in his
custom strategy. A defaults strategy available: with-all-class-properites
and without-all-class-properties.

Another thing is, that I need the cause of the exception, I handled that
with the patch.

> but it's important that i understand your use case so i make that i
> cover it.

so, you saw, its realy a simple case, class-properties in all class
extending Throwable.

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

sure. And thank you a lot for having a look at this. I would code it myself
and send a patch, if I could, but I'm not so into the betwixt code. There is
a lot of deprecated code, and this not yet finished (?) change of the mapper
for simple/complex types.

regards and thanks

Christoph


----- Original Message ----- 
From: "robert burrell donkin" <ro...@blueyonder.co.uk>
Newsgroups: gmane.comp.jakarta.commons.devel
Sent: Monday, September 27, 2004 11:51 PM
Subject: Re: [betwixt] Howto serialize the classname when writing XML


> 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
> correctly)...?
>
> (i'm guessing that you want to map a com.example.SomeException class to
> xml which looks something like:
>
> <exception>
> <message>Mysterious problem</message>
> <class>com.example.SomeException<class>
> </exception>)
>
> > 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.
>
> <snip>
>
> > 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


Re: [betwixt] Howto serialize the classname when writing XML

Posted by "Christoph Gaffga (triplemind.com)" <cg...@triplemind.com>.
<sorry>
auto-completion :(
wanted dev@triplemind.com not dev@cocoon.apache.org <:)
</sorry>


----- Original Message ----- 
From: "Christoph Gaffga (triplemind.com)" <cg...@triplemind.com>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Cc: <de...@cocoon.apache.org>
Sent: Wednesday, September 29, 2004 9:27 PM
Subject: Re: [betwixt] Howto serialize the classname when writing XML


> > a concrete example would be useful (so i'm sure i understand you
> > correctly)...?
> > (i'm guessing that you want to map a com.example.SomeException class to
> > xml which looks something like:
> > <exception>
> > <message>Mysterious problem</message>
> > <class>com.example.SomeException<class>
> > </exception>)
>
> exactly that was my intention. So: Between <class>...</class> there ist
only
> a string, the Class is not introspected.
> And I need the class-property only in class derived from Throwable, not
for
> all classes.
>
> For my usecase it would work if there is a switch, in the
> IntrospectionConfiguration for example, where I can put the output of
> class-property on/off. Then I would turn it on for all and add sumething
> like <hide property='class'/> to my dot-betwixt files.
>
> But it would be nicer and more flexible if everybody could plug in his
> custom strategy. A defaults strategy available: with-all-class-properites
> and without-all-class-properties.
>
> Another thing is, that I need the cause of the exception, I handled that
> with the patch.
>
> > but it's important that i understand your use case so i make that i
> > cover it.
>
> so, you saw, its realy a simple case, class-properties in all class
> extending Throwable.
>
> > 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...
>
> sure. And thank you a lot for having a look at this. I would code it
myself
> and send a patch, if I could, but I'm not so into the betwixt code. There
is
> a lot of deprecated code, and this not yet finished (?) change of the
mapper
> for simple/complex types.
>
> regards and thanks
>
> Christoph
>
>
> ----- Original Message ----- 
> From: "robert burrell donkin" <ro...@blueyonder.co.uk>
> Newsgroups: gmane.comp.jakarta.commons.devel
> Sent: Monday, September 27, 2004 11:51 PM
> Subject: Re: [betwixt] Howto serialize the classname when writing XML
>
>
> > 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
> > correctly)...?
> >
> > (i'm guessing that you want to map a com.example.SomeException class to
> > xml which looks something like:
> >
> > <exception>
> > <message>Mysterious problem</message>
> > <class>com.example.SomeException<class>
> > </exception>)
> >
> > > 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.
> >
> > <snip>
> >
> > > 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