Hi,
> Given the top-level object of an unmarshalling operation, the task is to
> write a method for visiting all elements in the object tree using
> reflection, not code for some specific set of object classes. The simple
> case (assuming a minimal subset of possibilities) is easy to solve, but the
> full general case is a little trickier.
>
> Does anybody know of such a general solution?
>
> (I realize that there might be two approaches: an iterator walking the tree
> or by listen to the unmarshaller. I'd prefer the first as it should permit
> visiting the objects in document order.)
I can think of a couple of approaches:
* Working with runtime models. Create a JAXB context with RI, retrieve
the models and process the content using all the classInfos and
propertyInfos from models. There's a number of cases to consider but
it's doable.
* A plugin which would augment the schema-derived classes with accept
methods for the generic visitor pattern. I had such a plugin for JAXB
1.
Bye,
/lexi