title: How do you customize how JAXB generates plural method names?
body: <p>We are using JAXB to generate Java classes and have encountered a few cases where generated plural method names are not correct. For example, where we expect <code>getPhysicians</code> we are getting <code>getPhysicien</code>. How would we customize how JAXB pluralizes specific methods?</p>
  
  <p>The schema:</p>
  
  <pre><code>&lt;xs:complexType name="physician"&gt;
      &lt;xs:sequence&gt;
         ...
      &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:complexType name="physicianList"&gt;
      &lt;xs:sequence&gt;
          &lt;xs:element name="Physician"
                      type="physician"
                      minOccurs="0"
                      maxOccurs="unbounded"/&gt;
      &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  </code></pre>
  
  <p>The generated Java code:</p>
  
  <pre><code>...
  public class PhysicianList {
  ...
  
      @XmlElement(name = "Physician")
      protected List&lt;Physician&gt; physicien;
      ...
  
      public List&lt;Physician&gt; getPhysicien() {
          if (physicien == null) {
              physicien = new ArrayList&lt;Physician&gt;();
          }
          return this.physicien;
      }
  </code></pre>
  
  <hr>
  
  <p><strong>Update</strong></p>
  
  <p>This has been answered by Blaise. However, I prefer not mixing concerns such as JAXB customizations in an XML schema. So for those of you with the same preference, here is a JAXB binding file that achieves the same thing as what Blaise suggested, keeping JAXB customization out of the schema:</p>
  
  <pre><code>&lt;jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
                 xmlns:xs="http://www.w3.org/2001/XMLSchema"
                 version="2.0"&gt;
  
      &lt;jaxb:bindings schemaLocation="myschema.xsd"&gt;
          &lt;jaxb:bindings node="//xs:complexType[@name='physicianList']//xs:element[@name='Physician']"&gt;
              &lt;jaxb:property name="physicians"/&gt;
          &lt;/jaxb:bindings&gt;
      &lt;/jaxb:bindings&gt;
  
  &lt;/jaxb:bindings&gt;
  </code></pre>