public static final class Adapter
extends XmlAdapter<Model, EnumGene>
{
@Override
public Model marshal(final EnumGene gene) {
final Function marshaller = jaxb.Marshaller(gene.getAllele());
final Model m = new Model();
m.length = gene.getValidAlleles().length();
m.allele.index = gene.getAlleleIndex();
m.allele.value = marshaller.apply(gene.getAllele());
m.alleles = gene.getValidAlleles()
.map(marshaller)
.asList();
return m;