Many people have found limitations in the implementation of List
properties since a wrapper is used around any list specified during
customization. The motivation for this wrapper is (quote from Kohsuke
Kawaguchi):
"The reason why the wrapper is used is that the RI needs to be able to
intercept
any change to a List. This handling is necessary to properly handle
element/attribute default
values. I don't particularly like the way it is, but that's the reason.
Because this is required by the spec, it's not something we can change
by ourselves."
I have not found anything in the specification saying a wrapper must be
used, but maybe I missed some sentence. The "interception of calls" can
be handled by some other methods, described below.
When you start using the collectionType customization you assume that
any interfaces (and methods) implemented by the list implementation will
be exposed to a client program, but since a wrapper is used this is not
true. Another solution which would have the desired properties described
above is to let JAXB auto generate a subclass (during schema
compilation) of the desired list implementation class. The subclass
could override the mutator methods to get the desired interception of
calls. The requirement for the list implementation would be:
1. The class must implement java.util.List
2. The class must have a default contructor
3. The class must not be final or declare the mutator methods as final.
The only new requirement on the list implementation is 3 since the other
two requirements must be fulfilled when using a wrapper. Maybe this
feature could be implemented as a vendor extension until the
specification can be changed.
What does everybody else think of this? I would really like to be able
to add functionality to the list implementation.
Erik
--------------------------------------------------
Gnistra
Erik Stensmo
erik_at_gnistra.se
Phone: +46(0)18 10 87 10
Mobile: +46(0)733 759 752
Home page: www.gnistra.se
--------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net