users@jaxb.java.net

Unmarshalling behaviour 2.1.0 versus 2.1.4

From: David Pick <david.pick_at_focus-solutions.co.uk>
Date: Mon, 16 Jul 2007 16:47:46 +0100

Hi,

I have just upgraded from version 2.1.0 to 2.1.4 and my unmarshalling code has broken for lists.

I was returning a copy of my internal list and then relying on the setter to mutate the list back again when the object was unmarshalled see below. This worked in 2.1.0 but in 2.1.4 the list setter is no longer called, the unmarshaller now adds the items to the list returned by the getter.

Has this behaviour been deprecated?
Or is there a way to get 2.1.4 to call the list based setter?


        @XmlElement(name="Section", type=Section.class)
        public List<ISection> getSections() {
                List<ISection> list = new ArrayList<ISection>(sections.size());
                for (OrderedItem item: sections) {
                        list.add((ISection)item.getItem());
                }

                return list;
        }

        public void setSections(final List<ISection> sections) {
                this.sections = new ArrayList<OrderedItem>();
                int order = 0;
                for (ISection section: sections) {
                        this.sections.add(new OrderedItem(order++, section));
                }
        }

Many Thanks
Dave



Dave Pick
Focus Software Ltd
Cranford House
Kenilworth Road
Leamington Spa
Warwickshire
CV32 6RQ

Tel: +44 (0) 1926 468300
Fax: +44 (0) 1926 468400
Direct: +44 (0) 1926 468397

dpick_at_focus-solutions.co.uk
davepick_at_fsoftware.co.uk

www.focus-solutions.co.uk

Copyright material and/or confidential and/or privileged information may be contained in this e-mail and any attached documents. The material and information is intended for the use of the intended addressee only. If you are not the intended addressee, or the person responsible for delivering it to the intended addressee, you may not copy, disclose, distribute, disseminate or deliver it to anyone else or use it in any unauthorised manner or take or omit to take any action in reliance on it. To do so is prohibited and may be unlawful. The views expressed in this e-mail may not be those of the Focus Solutions Group but the personal views of the originator. If you receive this e-mail in error, please advise the sender immediately by using the reply facility in your e-mail software. Please also delete this e-mail and all documents attached immediately. Many thanks for your co-operation.