title: How to tell only certain Classes in XSD to inheirt from a provided interface?
body: <p>I have found some other questions that ask this in a different way, but none of the answers to those questions work. Either the sites they refer to are dead or they are not for JAXB2.</p>
  
  <p>What I need is for more than a few of the generated classes to inherit from a common interface because they all have a <code>.getName()</code> method.</p>
  
  <p>Rather than have to have a huge <code>if(o instanceof XXX)</code> for each of the types, block I would rather just test against this common <code>Interface</code> by casting to it and calling <code>.getName()</code>.</p>
  
  <p>Here is my interface</p>
  
  <pre><code>package com.mycompany;
  
  public interface Nameable
  {
      public String getName();
  }
  </code></pre>
  
  <p>and here is what I am adding to my .xjb bindings file</p>
  
  <pre><code>&lt;jxb:bindings version="2.1"
            xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
            xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
            xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
            xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
            jxb:extensionBindingPrefixes="xjc inheritance"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  
  ...
  
  &lt;jxb:bindings node="//xsd:element[@name='container']"&gt;
    &lt;inheritance:implements&gt;com.mycompany.Nameable&lt;/inheritance:implements&gt;
  &lt;/jxb:bindings&gt;
  </code></pre>
  
  <p>It isn't adding anything to the generated classes.</p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "", propOrder = {
      "contents"
  })
  @XmlRootElement(name = "container")
  public class Container implements Cloneable, CopyTo, Equals, HashCode, MergeFrom, ToString
  {
     ...
  }
  </code></pre>
  
  <p>What is the magical incantation to get this interface added to the list?</p>