Note that there are some explanatory texts on larger screens.

plurals
  1. POJAXB Collections (List<T>) Use Pascal Case instead of Camel Case for Element Names
    primarykey
    data
    text
    <p>I have a number of JAXB beans that are directly marshalled and unmarshalled using Jersey.</p> <p>E.g.</p> <pre><code>@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; ... ... ... } </code></pre> <p>If I create a GET method that returns a single artifact object. It correctly produces the XML:</p> <pre><code>&lt;Artifact&gt; &lt;artifactId&gt;293289392839283&lt;/artifactId&gt; &lt;artifactType&gt;EMAIL&lt;/artifactType&gt; &lt;contentHash&gt;2837873827322&lt;/contentHash&gt; &lt;/Artifact&gt; </code></pre> <p>Here I have been able to successfully control the name of the Artifact element to have a capital "A" at the beginning.</p> <p>However, I create a GET method that returns collection of artifact objects, I end up with:</p> <pre><code>&lt;artifacts&gt; &lt;Artifact&gt; &lt;artifactId&gt;293289392839283&lt;/artifactId&gt; &lt;artifactType&gt;EMAIL&lt;/artifactType&gt; &lt;contentHash&gt;2837873827322&lt;/contentHash&gt; &lt;/Artifact&gt; &lt;Artifact&gt; &lt;artifactId&gt;293289392839283&lt;/artifactId&gt; &lt;artifactType&gt;EMAIL&lt;/artifactType&gt; &lt;contentHash&gt;2837873827322&lt;/contentHash&gt; &lt;/Artifact&gt; &lt;/artifacts&gt; </code></pre> <p>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.</p> <p>I can not see where this is possible to define within JAXB, is it actually the Jersey framework that is controlling this?</p> <p>Can we control of the element name generated for collections?</p> <p>Many thanks,</p> <p>James</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload