users@jersey.java.net

Re: [Jersey] Change XML property name ?

From: Bruno Cardoso <bcardoso.mail_at_gmail.com>
Date: Fri, 14 May 2010 10:43:54 +0100

I already had looked into
http://java.sun.com/javaee/5/docs/api/javax/xml/bind/annotation/package-summary.htmlbut
for some reason couldn't found the answer. Now that you said there was
an annotation for it I just looked better and found it.

@XmlElement(name = "account")

Obrigado

On Thu, May 13, 2010 at 5:01 PM, Tatu Saloranta <tsaloranta_at_gmail.com>wrote:

> Yes. Please read JAXB documentation or google for the answer. This
> should be found from a FAQ; you need to use an annotation (the only
> trick is that there are different annotations for collection
> properties and other ones).
>
> -+ Tatu +-
>
> On Thu, May 13, 2010 at 2:42 AM, Bruno Cardoso <bcardoso.home_at_gmail.com>
> wrote:
> > Is it possible to change the name of a xml property in my class?
> >
> > For example
> >
> > I have class Client that has:
> >
> > public List<Account> getAccounts() {
> > return accounts;
> > }
> >
> > In the xml the name of the property will be:
> > <accounts>
> > <id>1</id>
> > ....
> > </accounts>
> > <accounts>
> > <id>2</id>
> > ....
> > </accounts>
> >
> > but I wanted it to be <account>, I know i can just change the name of the
> > method but is there any other way?
> >
> > Thanks
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>