Package org.apache.ws.jaxme.generator.sg

Examples of org.apache.ws.jaxme.generator.sg.ParticleSG


   */
  private void generateCreateMethods(JavaSource pJs, ParticleSG[] pParticles,
                     String pName, Set pContextSet)
      throws SAXException {
    for (int i = 0;  i < pParticles.length;  i++) {
      ParticleSG particle = pParticles[i];
      if (particle.isGroup()) {
        GroupSG group = particle.getGroupSG();
        generateCreateMethods(pJs, group.getParticles(), pName, pContextSet);
      } else if (particle.isElement()) {
        ObjectSG oSG = particle.getObjectSG();
        if (oSG.isGlobal()) {
          continue// Will be generated elsewhere
        }
        TypeSG tSG = oSG.getTypeSG();
        if (tSG.isGlobalType()) {
          continue// Will be generated elsewhere
        }
        generateCreateMethod(pJs, pContextSet, tSG, pName);
      } else if (particle.isWildcard()) {
        throw new IllegalStateException("TODO: Add support for wildcards here.");
      } else {
        throw new IllegalStateException("Invalid class type");
      }
    }
View Full Code Here


    if (particles == null) {
      XSParticle[] xsParticles = ((XSGroup) getXSObject()).getParticles();
      particles = new ParticleSG[xsParticles.length];
      for (int i = 0;  i < xsParticles.length;  i++) {
        ParticleSGChain chain = (ParticleSGChain) pController.newParticleSG(xsParticles[i]);
        ParticleSG particle = new ParticleSGImpl(chain);
        particle.init();
        particles[i] = particle;
      }
    }
    return particles;
  }
View Full Code Here

  public void init(GroupSG pController) throws SAXException {
    XSParticle[] xsParticles = ((XSGroup) getXSObject()).getParticles();
    particles = new ParticleSG[xsParticles.length];
    for (int i = 0;  i < xsParticles.length;  i++) {
      ParticleSGChain chain = (ParticleSGChain) pController.newParticleSG(xsParticles[i]);
      ParticleSG particle = new ParticleSGImpl(chain);
      particle.init();
      particles[i] = particle;
    }
  }
View Full Code Here

  public void generateProperties(GroupSG pController, JavaSource pSource) throws SAXException {
    final String mName = "generateProperties(JavaSource)";
    log.finest(mName, "->", pSource.getQName());
    ParticleSG[] myParticles = pController.getParticles();
    for (int i = 0;  i < particles.length;  i++) {
      ParticleSG particle = myParticles[i];
      if (particle.isElement()) {
        PropertySG elementSG = particle.getPropertySG();
        elementSG.generate(pSource);
      } else if (particle.isGroup()) {
        GroupSG groupSG = particle.getGroupSG();
        groupSG.generateProperties(pSource);
      } else if (particle.isWildcard()) {
        PropertySG wildcardSG = particle.getPropertySG();
        wildcardSG.generate(pSource);
      } else {
        throw new IllegalStateException("Unknown particle type: Neither of element, group, or wildcard");
      }
    }
View Full Code Here

  public void generateXMLInterfaceSubclasses(GroupSG pController, JavaSource pSource) throws SAXException {
    final String mName = "generateSubClasses(JavaSource)";
    log.finest(mName, "->", pSource.getQName());
    ParticleSG[] myParticles = pController.getParticles();
    for (int i = 0;  i < particles.length;  i++) {
      ParticleSG particle = myParticles[i];
      if (particle.isElement()) {
        ObjectSG elementSG = particle.getObjectSG();
        TypeSG typeSG = elementSG.getTypeSG();
        if (!typeSG.isGlobalType()  &&  typeSG.isComplex()) {
          ComplexTypeSG complexTypeSG = typeSG.getComplexTypeSG();
          complexTypeSG.getXMLInterface(pSource);
        }
      } else if (particle.isGroup()) {
        GroupSG groupSG = particle.getGroupSG();
        groupSG.generateXMLInterfaceSubclasses(pSource);
      } else if (particle.isWildcard()) {
        // Do nothing
      } else {
        throw new IllegalStateException("Unknown particle type: Neither of element, group, or wildcard");
      }
    }
View Full Code Here

  public void generateXMLImplementationSubclasses(GroupSG pController, JavaSource pSource) throws SAXException {
    final String mName = "generateSubClasses(JavaSource,JavaQName)";
    log.finest(mName, "->", new Object[]{pSource.getQName()});
    ParticleSG[] myParticles = pController.getParticles();
    for (int i = 0;  i < particles.length;  i++) {
      ParticleSG particle = myParticles[i];
      if (particle.isElement()) {
        ObjectSG elementSG = particle.getObjectSG();
        TypeSG typeSG = elementSG.getTypeSG();
        if (!typeSG.isGlobalType()  &&  typeSG.isComplex()) {
          ComplexTypeSG complexTypeSG = typeSG.getComplexTypeSG();
          complexTypeSG.getXMLImplementation(pSource);
        }
      } else if (particle.isGroup()) {
        GroupSG groupSG = particle.getGroupSG();
        groupSG.generateXMLImplementationSubclasses(pSource);
      } else if (particle.isWildcard()) {
          // Do nothing
      } else {
        throw new IllegalStateException("Unknown particle type: Neither of element, group, or wildcard");
      }
    }
View Full Code Here

  private JavaMethod getXMLSerializersInitMethod(GroupSG pController, JavaSource pSource) throws SAXException {
    ParticleSG[] myParticles = pController.getParticles();
    JavaMethod jm = null;
    DirectAccessible pFactory = null;
    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()) {
View Full Code Here

    ParticleSG[] myParticles = pController.getParticles();
    JavaMethod jm = null;
    LocalJavaField pElement = null;
    XMLSerializersMarshalChildsSGlet sgLet = null;
    for (int i = 0;  i < myParticles.length;  i++) {
      ParticleSG particle = myParticles[i];
      if (jm == null) {
        jm = pSource.newJavaMethod("marshalChilds", JavaQNameImpl.VOID, JavaSource.PROTECTED);
        DirectAccessible pData = jm.addParam(JavaQNameImpl.getInstance(JMXmlSerializer.Data.class), "pData");
        sgLet = new XMLSerializersMarshalChildsSGlet(pData);
        JavaQName elementInterface = pController.getClassContext().getXMLInterfaceName();
        DirectAccessible pObject = jm.addParam(Object.class, "pObject");
        pElement = jm.newJavaField(elementInterface);
        pElement.addLine("(", elementInterface, ") ", pObject);
        jm.addThrows(SAXException.class);
      }

      if (!particle.isElement()) {
        // TODO: Implement handling for wildcards and subgroups
        //throw new IllegalStateException("Wildcards and subgroups are not implemented.");
        return jm;
      }
     
      sgLet.setChild(particle);
      sgLet.setFieldName(getXMLSerializersFieldName(particle.getPropertySG()));
      particle.getPropertySG().forAllNonNullValues(jm, pElement, sgLet);
    }
    log.finest(mName, "<-");
    return jm;
  }
View Full Code Here

    log.finest(mName, "->", pSource.getQName());
    getXMLSerializersInitMethod(pController, pSource);
    getXMLSerializersMarshalChildsMethod(pController, pSource);
    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()  &&  !typeSG.isGlobalClass()) {
          typeSG.getComplexTypeSG().getXMLSerializer(pSource);
        }
      }
View Full Code Here

  }

  private void getXMLHandlersElements(GroupSG pController, JavaSource pSource) throws SAXException {
    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()  &&  !typeSG.isGlobalClass()) {
          typeSG.getComplexTypeSG().getXMLHandler(pSource);
        }
      }
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.generator.sg.ParticleSG

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.