private JavaMethod getXMLHandlersInitMethod(GroupSG pController, JavaSource pSource) throws SAXException {
JavaMethod jm = null;
DirectAccessible pData = null;
ParticleSG[] myParticles = pController.getParticles();
for (int i = 0; i < myParticles.length; i++) {
ParticleSG particle = myParticles[i];
if (particle.isElement()) {
ObjectSG objectSG = particle.getObjectSG();
TypeSG typeSG = objectSG.getTypeSG();
if (typeSG.isComplex()) {
if (jm == null) {
jm = pSource.newJavaMethod("init", JavaQNameImpl.VOID, JavaSource.PUBLIC);
pData = jm.addParam(JMHandler.Data.class, "pData");
jm.addThrows(JAXBException.class);
jm.addLine("super.init(", pData, ");");
}
String f = particle.getPropertySG().getXMLFieldName();
String handlerFieldName = "__handler_" + f;
String handlerMethodName = getXMLHandlersMethodName(particle.getPropertySG());
JavaField jf = pSource.newJavaField(handlerFieldName, JMHandler.class, JavaSource.PRIVATE);
JavaMethod jm2 = pSource.newJavaMethod(handlerMethodName, JMHandler.class, "protected");
jm2.addThrows(SAXException.class);
jm2.addIf(handlerFieldName, " == null");