for (int i = 0; i < myParticles.length; i++) {
ParticleSG particle = myParticles[i];
if (!particle.isElement()) {
continue;
}
ObjectSG child = particle.getObjectSG();
if (!child.getTypeSG().isComplex()) {
continue;
}
if (jm == null) {
jm = pSource.newJavaMethod("init", JavaQNameImpl.VOID, JavaSource.PUBLIC);
pFactory = jm.addParam(JAXBContextImpl.class, "pFactory");
jm.addLine("super.init(", pFactory, ");");
jm.addThrows(JAXBException.class);
}
String serializerName = getXMLSerializersFieldName(particle.getPropertySG());
Context myClassContext = child.getTypeSG().getComplexTypeSG().getClassContext();
JavaQName serializerClass = myClassContext.getXMLSerializerName();
JavaField jf = pSource.newJavaField(serializerName, serializerClass, JavaSource.PRIVATE);
JavaQName elementInterface = myClassContext.getXMLInterfaceName();
if (child.getTypeSG().isGlobalClass()) {
jm.addLine(jf, " = (", serializerClass, ") ", pFactory, ".getJMXmlSerializer(", elementInterface, ".class);");
} else {
jm.addLine(jf, " = new ", serializerClass, "();");
}
jm.addLine(jf, ".init(pFactory);");