Yes, that's per the JAXB spec. Version 2.1 (Dec 2006), Section 5.5.2.2 "List Property":
Design Note – There is no setter method for a List property. The getter returns
the List by reference. An item can be added to the List returned by the getter
method using an appropriate method defined on java.util.List. Rationale
for this design in JAXB 1.0 was to enable the implementation to wrapper the list
and be able to perform checks as content was added or removed from the List.
Glen
metro wrote:
I was thinking about registering this issue as a bug but decided to poll the forum first...
It appears that JAXB RI ignores collection setters while unmarshalling XML into objects. Instead, it invokes the appropriate getter and then works directly with the returned collection.
While most of the time it wouldn't matter, I have some specialized setters to help reconnect the object tree after unmarshalling and don't appreciate those setters being ignored. In general, I think this behavior is rather unintuitive and not portable (after all, JAXB is supposed to be a specification not a single-implementation technology).
Would anyone care to comment?
-Alex
[Message sent by forum member 'alexkos' (alexkos)]
http://forums.java.net/jive/thread.jspa?messageID=285138---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
For additional commands, e-mail: users-help@metro.dev.java.net