AndreVanDelft / scalaxb-old

scalaxb is an XML data binding tool for Scala.
http://scalaxb.org/
MIT License
0 stars 0 forks source link

Generate Visitor code #3

Open AndreVanDelft opened 8 years ago

AndreVanDelft commented 8 years ago

To make the generated classes of scalaxb really useful for my OfficeOpenXML-related development project, we need some visitor infrastructure. There are several options:

  1. just make this provision for the generated scalaxb code of OpenOffice
  2. add a command line option to the scalaxb generator, to generate a visitor
  3. do something at run-time with macros

In docx4j, approach 1 was taken; see here. One drawback with this approach is that is limited to the OfficeOpen code. Moreover, there is no guaranty that every node is visited.

For jaxb, there is a better solution of type 2: a plug in to the code generator, that creates visitor code. See jaxb-visitor. We could mimic this as a command line option in scalaxb, rather than a plugin.

I think Tolya could also create macro's that generate the visitors at run time. I would prefer the command line option though since that seems easier to understand for slightly less advanced developers.