[betwixt] Specify a certain class in a betwixt file

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[betwixt] Specify a certain class in a betwixt file

Wim Deblauwe
Hi,

is it possible to specify a certain type of class in you betwixt file that
the introspector should use?

I'm having problems with a class that returns a certain type of object. This
object implements the comparable interface also. The introspector treats
this object as a comparable and not as the real object. What I would like to
do is this:

<?xml version="1.0" encoding="UTF-8" ?>
<info>
<element name="luminanceRange">
<element name="minimum" property="minimum" class="com.blabla.MyClass"/>
<element name="maximum" property="maximum" class="com.blabla.MyClass"/>
</element>
</info>

The extremely strange thing is that the minimum property is serialized
correctly (as MyClass, even without any betwixt file) and the maximum is not
(it is seen as a comparable) although they are the properties of the same
class! I'm currently trying to reproduce this problem in a simple testcase,
but no luck so far.

regards,

Wim
Reply | Threaded
Open this post in threaded view
|

Re: [betwixt] Specify a certain class in a betwixt file

Thomas Dudziak
On 9/1/05, Wim Deblauwe <[hidden email]> wrote:

> is it possible to specify a certain type of class in you betwixt file that
> the introspector should use?

Not sure whether really helps, but you might want to try the
mappingDerivation attribute for your element:

mappingDerivation='introspection'

see here for more info:

http://jakarta.apache.org/commons/betwixt/guide/derived.html

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [betwixt] Specify a certain class in a betwixt file

robert burrell donkin
On Thu, 2005-09-01 at 14:10 +0200, Thomas Dudziak wrote:

> On 9/1/05, Wim Deblauwe <[hidden email]> wrote:
>
> > is it possible to specify a certain type of class in you betwixt file that
> > the introspector should use?
>
> Not sure whether really helps, but you might want to try the
> mappingDerivation attribute for your element:
>
> mappingDerivation='introspection'
>
> see here for more info:
>
> http://jakarta.apache.org/commons/betwixt/guide/derived.html

there is a strategy which allows class substitution
(http://jakarta.apache.org/commons/betwixt/guide/binding.html#Introspection%20And%20Normalization) but not forced substitution in a betwixt file.

try setting the 'type' property for the element. though not guaranteed,
it may work.

otherwise, i suggest downloading the latest source from SVN, building
and running an IDE debugging and examine the results of the
introspection. just run XMLIntrospector.introspect and take a look at
the element descriptor for maximum in the XmlBeanInfo.

- robert


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]