users@jaxb.java.net

Re: JAXB Customization collectionType

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Fri, 19 Aug 2005 10:59:44 +0200

Hi.

> I have couple of questions on JAXB Customizations and a question on
> Marshalling.
>
> JAXB 1.0 Customization allow clients to choose the collection type at
> global level and at a property level.
>
> 1. Is there any way to choose the collectionType to be Set but the impl
> to be HashSet ?

I think set will lose ordering information.
>
> 2. Also for a child element whose maxOccurs="unbounded", I donot see
> appropriate equals() and hashcode() in the generated Java Bean.
> Is there anyway to plugin the equals() and hashcode() implementations ?

Yes. See jaxbcommons project for "equals" and "hashCode" add-ons.

> 3. Is there anyway to know if the JAXB Generated Java Bean Tree is
> modified, so as to Marshall only when its needed.

Nothing built-in, as far as I know. You can use hashCode and equals to
do that. It's quite effective.

Bye.
/lexi