Hi All,
I have a number of JAXB beans that are directly marshalled and unmarshalled using Jersey.
E.g.
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Artifact", propOrder = {
"artifactId",
"artifactType",
"contentHash"
})
@XmlSeeAlso({
EmailArtifact.class,
ManagedDocArtifact.class
})
@XmlRootElement(name ="Artifact")
public class Artifact {
protected String artifactId;
protected String artifactType;
protected String contentHash;
...
...
...
}
If I create a GET method that returns a single artifact object. It correctly produces the XML:
<Artifact>
<artifactId>293289392839283</artifactId>
<artifactType>EMAIL</artifactType>
<contentHash>2837873827322</contentHash>
</Artifact>
Here I have been able to successfully control the name of the Artifact element to have a capital "A" at the beginning.
However, I create a GET method that returns collection of artifact objects, I end up with:
<artifacts>
<Artifact>
<artifactId>293289392839283</artifactId>
<artifactType>EMAIL</artifactType>
<contentHash>2837873827322</contentHash>
</Artifact>
<Artifact>
<artifactId>293289392839283</artifactId>
<artifactType>EMAIL</artifactType>
<contentHash>2837873827322</contentHash>
</Artifact>
</artifacts>
As you can see the outer element for the collection has a lower case "A". In order to conform to our own internal standard I would like this to be a capital "A" - Artifacts.
I can not see where this is possible to define within JAXB, is it actually the Jersey framework that is controlling this?
Can we control of the element name generated for collections?
Many thanks,
James