Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Customize wrapper pluralization

$
0
0
Hi,

i just migrated to CXF and I need to know how i can customize the
pluralization done by CXF to obtain the wrapper name when returning a
collection. For example, "country" is pluralized to "countrys" and i need it
to be "countries".
Please see my use case below.

@Path("/countries")
public class SupportedCountriesResource {
@GET
List<Country> list() {
...

@XmlRootElement(name = "country")
@XmlAccessorType(XmlAccessType.FIELD)
public class Country {
@XmlElement(name = "code")
private String code;

@XmlElement(name = "name")
private String name;

...

I need to have the following xml and json (using
org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider) outputs :

<?xml version="1.0" encoding="UTF-8"?>
<countries>
<country>
<code>AF</code>
<name>Afghanistan</name>
</country>
<country>
<code>AL</code>
<name>Albania</name>
</country>
...
</countries>

"code":"AF",
"name":"Afghanistan"
},

"code":"AL",
"name":"Albania"

...

Thanks for your help,

Fabien

Viewing all articles
Browse latest Browse all 5648

Trending Articles