Hi Henri,
The JiBX implementation of this gives flexibility at the cost of
requiring that <structure map-as="base-class"/> in order to invoke the
base mapping. The flexibility is that you can control where the base
mapping is invoked - or even if it's invoked at all. The alternative
would probably be to do something like schema, where extensions always
have the base type representation coming before any added information.
I'm trying to be somewhat more orthogonal than schema in how I structure
things, though.
If there's an extends="base-class" without a <structure
map-as="base-class"/> it just means that you're making this mapping part
of the group which can substitute for instances of the base-class.
That's really what extends="base-class" means in general - whether you
actually use the base-class mapping in the format for the extension or
not is irrelevant as far as JiBX is concerned. With or without
extends="base-class", <structure map-as="base-class"/> implies that the
current class is a subclass (or implementation class) of base-class.
- Dennis
Henri Dupre wrote:
I changed some of our mapping to make usage of the "abstract"
capability of jibx.
So I have an abstract class and an abstract mapping
<mapping abstract="true" class="com.actualis.ActualisBO">
<!-- com.actualis.ActualisBO fields -->
<value name="sync_state" field="sync_state"/>
<value name="UID" field="UID"/>
</mapping>
And then in every my inherited classes, I need to have sync_state and UID.
<mapping name="Article" class="com.actualis.sage.Article"
extends="com.actualis.ActualisBO">
<structure map-as="com.actualis.ActualisBO"/>
<value name="AR_Ref" usage="optional" field="AR_Ref"/>
...
</mapping>
I was wondering, why is the structure map-as necessary? If there is no
<structure map-as...> what is the sense of the extends and abstract?
Shouldn't all the fields from the parent class be included by default?
Thanks,
Henri.
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today
Register for a JBoss Training Course. Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28&alloc_id845&opÌk
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today
Register for a JBoss Training Course. Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28&alloc_id845&op=click
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users