users@jersey.java.net

Re: [Jersey] no-arg constructors (probably JAXB-related)

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Wed, 28 Oct 2009 10:36:01 -0400

On Oct 28, 2009, at 10:16 AM, Zoltan Arnold NAGY wrote:
>
> Let's say I have an immutable class Data, which is returned (as a
> JSON) by a webservice
> method.
> Why is it a requirement to have a no-arg constructor for classes
> used together with JAXB?
>
Its a JAXB thing. Note that even though you do need a no-arg ctor you
don't need property setters so you can still have immutable classes.
See @XmlAccessorType(XmlAccessType.FIELD).

Marc.


> The client application is multi-threaded, so I'd prefer to use
> immutable classes and as I already
> have a shared jar containing shared classes across multiple
> programs, I'd like to reuse it.
>
> Is there something I could do?
>
> Thanks,
> Zoltan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>