Hi Thomas,
The intent of abstract mappings has kind of evolved over the last year -
in a good way, I think, but enough to cause confusion to anyone used to
the original version. All you need to do for this is change the
<collection> structure to:
<collection field="hexes">
<structure type="com.softstart.stellar.data.HexID" name="location"/>
</collection>
or similar variations. I wasn't able to actually try this out, since
your sample file didn't have any data for this case, but did verify that
the code generation completed successfully.
The idea of using element names for abstract mappings doesn't fit very
well with the new intent, so I've now added a deprecated warning for
this just to discourage people from doing it. You might want to review
the new parts of the binding tutorial, especially the mappings page:
http://jibx.sourceforge.net/tutorial/binding-mappings.html I'll respond
to your other issues in Jira.
Thanks,
- Dennis
BTW, looks like a cool application!
Thomas Jones-Low wrote:
Here the thing I've spend most of the day beaing my head against
the wall for. I've filed a bug in Jira for this, but it may not be a
bug, just my misunderstanding of the new RC2 code.
I have a mapping (short version):
<mapping class="com.softstart.stellar.data.HexID"
post-set="convertHextoID" abstract="true">
<value style="attribute" name="type" field="hexType" />
<value style="attribute" name="group" field="hexGroup" />
<value style="text" field="hex" />
</mapping>
I would like to use this mapping in two ways, as a structure in one
mapping:
<mapping name="system" class="com.softstart.stellar.data.StarSystem"
post-set="update">
<value style="attribute" name="id" field="key" />
<value style="attribute" name="provider" field="providerName"
usage="optional" />
<value name="name" field="name" />
<structure field="location" name="location"/>
</mapping>
and as a collection of locations in another mapping:
<mapping name="link" class="com.softstart.stellar.data.Links">
<structure map-as="com.softstart.stellar.data.Record" />
<collection field="hexes" item-type="com.softstart.stellar.data.HexID"/>
<value style="attribute" name="linkType" field="linkTypeName"
usage="optional"/>
</mapping>
In order for the second mapping to work (the links collection) I need
to give the HexID mapping a name attribute. But if I do so the system
mapping fails on reading, because it's now looking for a nested
<location><location></location></location> tag. The unmarshal code
throws a JiBX exception with the message "expected "location" start
tag, found "location" end tag"
If I remove the name attribute from the (as above) I get another JiBX
exception "no unmarshallar for element location".
How to address this issue?
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users