Hi all,

When I map

public abstract class Task {
   private String name;
   private Sring description;
}

public class EchoTask extends Task {
   private String text;
   private boolean newLine;
}

as

   <mapping name="task" abstract="true" class="org.oh.dm.Task"
       value-style="attribute">
       <value name="name" field="name" usage="optional"/>
       <value name="description" field="description" usage="optional"/>
   </mapping>

   <mapping name="echo" class="org.oh.dm.tasks.EchoTask"
       extends="org.oh.dm.Task" value-style="attribute">
       <structure map-as="org.oh.dm.Task"/>
       <value name="text" field="text" usage="optional"/>
       <value name="newline" field="newLine" usage="optional"/>
   </mapping>

I expect a xml result as:

   <echo name="xxx" description="descrip" text="echo 3"/>

however I have:

<echo text="echo 3">
<task description="descrip"/>
</echo>


So I did ...

   <mapping name="echo" class="org.oh.dm.tasks.EchoTask"
       extends="org.oh.dm.Task" value-style="attribute">
       <!--
        Attributes in superclasse must be changed to protected to do this.
       -->
       <value name="name" field="name" usage="optional"/>
       <value name="description" field="description" usage="optional"/>

       <value name="text" field="text" usage="optional"/>
       <value name="newline" field="newLine" usage="optional"/>
   </mapping>

And I get the expected result, however I think would be better if I can do it without change my class attributes to protected.
Is this possible? There is another way to deal with this?


Thanks,

Neimar



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to