mklemm/jaxb2-rich-contract-plugin — pull request #7 by tpunder (2014-09-05 21:54:11+00:00)
Title: Fix not generating assignments for primitive types in the copy construct...

The copy constructor currently ignores primitives field types. For example given this from an XSD file:

<xs:simpleType name="QuantityPerApplication">
<xs:restriction base="xs:positiveInteger">
<xs:maxInclusive value="99999999"/>
</xs:restriction>
</xs:simpleType>
<complexType>
<simpleContent>
<extension base="<http://www.aftermarket.org>QuantityPerApplication">
<attribute name="Qualifier" type="{http://www.aftermarket.org}QuantityPerApplicationQualifierType" />
<attribute name="UOM" use="required">
<simpleType>
<restriction base="{http://www.w3.org/2001/XMLSchema}string">
<length value="2"/>
</restriction>
</simpleType>
</attribute>
</extension>
</simpleContent>
</complexType>

I end up with a class that has these fields:

```
@XmlValue
protected int value;
@XmlAttribute(name = "Qualifier")
protected QuantityPerApplicationQualifierType qualifier;
@XmlAttribute(name = "UOM", required = true)
protected String uom;
```

And a Builder constructor of:

```
public Builder(final TParentBuilder parentBuilder, final QuantityPerApplication other, final boolean copy) {
this._parentBuilder = parentBuilder;
if (copy) {
this._product = null;
this.qualifier = other.qualifier;
this.uom = other.uom;
} else {
this._product = other;
}
}
```
Which is missing: `this.value = other.value;` so I end up with a default value of 0 for the int. This patch changes the generated code to be:

```
public Builder(final TParentBuilder parentBuilder, final QuantityPerApplication other, final boolean copy) {
this._parentBuilder = parentBuilder;
if (copy) {
this._product = null;
this.value = other.value;
this.qualifier = other.qualifier;
this.uom = other.uom;
} else {
this._product = other;
}
}
```