Jeremy Haile wrote:
It sounds like your annotations are used to generate a Castor mapping
XML file.  JAXB actually works by reading the annotations at runtime -
meaning that no XML file would be required at all.  This would require
Castor to be modified to support reading the annotations at runtime
rather than reading the XML mapping file.  In fact, perhaps the Castor
introspection code could simply be modified to recognize the annotations
when figuring out how to map "unmapped" classes.

That seems like a good approach...it shouldn't be too hard to modify the introspector for this purpose, actually it might be good to design a simple plugin API for the introspector and then it as a plugin.


The annotations used by JAXB have a one-to-one mapping to the mappings
provided by Castor for the most part, with only a few additions (which I
really like)  For example, JAXB allows you to do something like the
following: <autoDealership>
  <vehicles>
      <car make="Ford" model="Mustang" convertible="false"/>
      <truck make="Nissan" model="Titan" fourWheelDrive="true"/>
   </vehicles>
</autoDealership>

I believe the only way this can be represented in Castor (correct me if
I'm wrong) is:
<autoDealership>
  <vehicle xsi:type="car" .... />
   <vehicle xsi:type="truck" .... />
</autoDealership>


Castor supports both examples. For the first example you just need to use auto-naming="deriveByClass" on the bind-xml element and make the collection a first-class object by using container="false".

Something like the following should do the trick:

<field name="vehicles" type="java.lang.Object" collection="..."
   container="false">
   <bind-xml auto-naming="deriveByClass"/>
</field>

--Keith

-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to