You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Wim Deblauwe <wi...@gmail.com> on 2005/09/01 10:08:29 UTC
[betwixt] Specify a certain class in a betwixt file
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
Re: [betwixt] Specify a certain class in a betwixt file
Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On Thu, 2005-09-01 at 14:10 +0200, Thomas Dudziak wrote:
> On 9/1/05, Wim Deblauwe <wi...@gmail.com> 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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [betwixt] Specify a certain class in a betwixt file
Posted by Thomas Dudziak <to...@gmail.com>.
On 9/1/05, Wim Deblauwe <wi...@gmail.com> 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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org