title: Insert custom setter in maven-jaxb2-plugin
body: <p>I'm using the <a href="http://java.net/projects/maven-jaxb2-plugin/pages/Home" rel="nofollow">org.jvnet.jaxb2.maven2:maven-jaxb2-plugin</a> to create POJOs from XSD schema files.</p>
  
  <p>Now I want to insert something like a custom setter. It should trim all Strings and should remove certain characters. </p>
  
  <p>Do you know how to do this?</p>
  
  <hr>
  
  <p><strong>The XJB file:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;jaxb:bindings version="2.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"&gt;
      &lt;jaxb:bindings schemaLocation="my-schema-xml4.xsd" node="/xs:schema"&gt;
          &lt;xjc:javaType name="java.lang.String" adapter="my.StringAdapter" /&gt;
      &lt;/jaxb:bindings&gt;
  &lt;/jaxb:bindings&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>Solution for binding Java types:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;bindings version="2.0" xmlns="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"&gt;
      &lt;bindings schemaLocation="mySchema-xml4.xsd" node="/xs:schema"&gt;
          &lt;globalBindings&gt;
              &lt;xjc:javaType name="java.lang.String" xmlType="xs:string"
                  adapter="com.name.MyAdapter" /&gt;
                      &lt;xjc:javaType name="java.lang.String" xmlType="xs:anySimpleType"
                  adapter="com.name.MyAdapter" /&gt;
          &lt;/globalBindings&gt;
      &lt;/bindings&gt;
  &lt;/bindings&gt;
  </code></pre>
  
  <hr>
  
  <p>But the <code>@XmlJavaTypeAdapter</code> still isn't added to the <code>content</code> property in nodes with mixed content, although the property has the type <code>java.lang.String</code>.</p>