users@jaxb.java.net

Re: XJC and the visitor pattern

From: Christian Schulte <cs_at_schulte.it>
Date: Mon, 26 Oct 2009 21:23:27 +0100

Aleksei Valikov schrieb:
> Hi,
>
>> I would like XJC to add visitor support to schema derived classes.
>> Looking at jaxb2-commons and hyperjaxb3 I could not find a plugin
>> supporting this. Does such a plugin exist ?
>
> I don't know of such plugin, but I think writing it makes sense.
> Would you mind putting together few code examples - as you expect ths
> visitor pattern to be implemented? We can discuss the design and I can
> overtake the implementation.
>
> Bye,
> /lexi
>

Comparing the two java examples given at [0] and [1], I am not quite
sure how those accept methods would need to be implemented (and if
that's at all what I am looking for). If all there is to implement in
those accept methods is a line of code like 'visitor.visit(this)',
things should be really easy. If the accept method additionally iterates
all referenced objects, things could become quite complex. I am a bit
confused about that pattern now, I admit.

[0] http://de.wikipedia.org/wiki/Visitor
[1] http://en.wikipedia.org/wiki/Visitor_pattern

-- 
Christian