I see in my own experiments that JAX-B maps a choice to a collection of
JAXBElement. I also see in the tutorial the suggestion to write a
handler if I need access to the specific types.
Suppose I have
<xsd:choice maxoccurs="unbounded">
<xsd:element name="a" type="aType"/>
<xsd:element name="b" type="bType"/>
</xsd:choice>
(My real example is more complicated but this is enough to demonstrate
the problem.)
What JAX-B generates is
public List<JAXBElement<?>> get...
where it generates the method name.
First, what I would really like is for JAX-B to generate
List<AType> getA() {...}
List<BType> getB() {...}
Second, given that it does not do that I understand that a handler can
help me here. What strikes me is that JAX-B has all the information at
build-time that's needed to write the handler. It would be far better
at doing that than I would be doing so manually.
Is there a way to
1. have JAX-B generate the two get separate, type-specific get methods
or
2. have JAX-B generate the handler for me?
Thanks.
- Tim