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

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


    handlerSG.generate();
    if (!pController.hasSimpleContent()) {
      ComplexContentSG ccSG = pController.getComplexContentSG();
      ParticleSG[] particles = ccSG.getElementParticles();
      for (int i = 0;  i < particles.length;  i++) {
        ParticleSG particle = particles[i];
        TypeSG tSG = particle.getObjectSG().getTypeSG();
        if (tSG.isComplex()  &&  !tSG.isGlobalClass()) {
          tSG.getComplexTypeSG().getXMLHandler(pJs);
        }
      }
    }
View Full Code Here


    JavaField jf = getJavaSource().newJavaField("__state", int.class, JavaSource.PRIVATE);
    JavaComment jc = jf.newComment();
    jc.addLine("The current state. The following values are valid states:");
    jc.addLine(" 0 = Before parsing the element");
    for (int i = 0;  i < particles.length;  i++) {
      ParticleSG particle = particles[i];
      if (particle.isGroup()) {
        GroupSG group = particle.getGroupSG();
        if (group.isGlobal()) {
          jc.addLine(" " + getState(i) + " = While parsing the nested group " + group.getName());
        } else {
          jc.addLine(" " + getState(i) + " = While parsing the nested group " + GroupUtil.getGroupName(group));
        }
      } else if (particle.isElement()) {
        jc.addLine(" " + getState(i) + " = While or after parsing the child element " + particle.getObjectSG().getName());
      } else if (particle.isWildcard()) {
        throw new IllegalStateException("TODO: Add support for wildcards.");
      } else {
        throw new IllegalStateException("Invalid particle type.");
      }
    }
View Full Code Here

  private int getFirstValidParticle(int pState) {
    if (pState == 0) {
      return 0;
    } else {
      int i = fromState(pState);
      ParticleSG particle = particles[i];
      if (particle.isMultiple()) {
        return i;
      } else if (i+1 < particles.length) {
        return i+1;
      } else {
        return -1;
View Full Code Here

      if (lastParticle >= particles.length) {
        return fromState(pState);
      }
    }
    while (lastParticle < particles.length-1) {
      ParticleSG particle = particles[lastParticle];
      if (isRequiredParticle(particle)) {
        break;
      } else {
        ++lastParticle;
      }
View Full Code Here

  public JavaMethod newIsFinishedMethod() throws SAXException {
    JavaMethod result = super.newIsFinishedMethod();
    result.addSwitch(getStateField());
    boolean allOptional = true;
    for (int i = particles.length-1;  i >= 0;  i--) {
      ParticleSG particle = particles[i];
      result.addCase(new Integer(getState(i)));
      if (isRequiredParticle(particle)) {
        allOptional = false;
        break;
      }
View Full Code Here

    }
  }

  private void generateSubclasses(JavaSource pJs) throws SAXException {
    for (int i = 0;  i < particles.length;  i++) {
      ParticleSG particle = particles[i];
      if (particle.isElement()) {
        ObjectSG elementSG = particle.getObjectSG();
        TypeSG typeSG = elementSG.getTypeSG();
        if (!typeSG.isGlobalType()  &&  !typeSG.isGlobalClass()  &&  typeSG.isComplex()) {
          ComplexTypeSG complexTypeSG = typeSG.getComplexTypeSG();
          if (pJs.isInterface()) {
            complexTypeSG.getXMLInterface(pJs);
          } else {
            complexTypeSG.getXMLImplementation(pJs);
          }
            }
      } else if (particle.isGroup()) {
        GroupBeanSG beanSG = newBeanSG(particle.getGroupSG());
        beanSG.generateSubclasses(pJs);
      } else if (particle.isWildcard()) {
        throw new IllegalStateException("TODO: Add support for wildcards");
      } else {
        throw new IllegalStateException("Unknown particle type: Neither of element, group, or wildcard");
      }
    }
View Full Code Here

    }
  }

  private void findGroups(ParticleSG[] pParticles) throws SAXException {
    for (int i = 0;  i < pParticles.length;  i++) {
      ParticleSG particle = pParticles[i];
      if (particle.isGroup()) {
        GroupSG group = particle.getGroupSG();
        if (!groups.containsKey(group)) {
          GroupDriverSG driver = newGroupDriverSG(group);
          groups.put(group, driver);
        }
      }
View Full Code Here

  }

  protected void addNames(List pNames, GroupSG pGroup) throws SAXException {
    ParticleSG[] particles = pGroup.getParticles();
    for (int i = 0;  i < particles.length;  i++) {
      ParticleSG particle = particles[i];
      if (particle.isElement()) {
        pNames.add(particle.getObjectSG().getName());
      } else if (particle.isGroup()) {
        addNames(pNames, particle.getGroupSG());
      } else if (particle.isWildcard()) {
        throw new IllegalStateException("TODO: Add support for wildcards");
      } else {
        throw new IllegalStateException("Invalid particle type");
      }
    }
View Full Code Here

  }

  private void marshalParticles(JavaMethod pJm, LocalJavaField pElement,
                  ParticleSG[] pParticles) throws SAXException {
    for (int i = 0;  i < pParticles.length;  i++) {
      final ParticleSG particle = pParticles[i];
      if (particle.isElement()) {
        SGlet sgLet = new SGlet(){
          public void generate(JavaMethod pMethod, Object pValue) throws SAXException {
            marshalElementParticle(pMethod, pValue, particle);
          }
        };
        particle.getPropertySG().forAllNonNullValues(pJm, pElement, sgLet);
      } else if (particle.isGroup()) {
        marshalGroupParticle(pJm, pElement, particle);
      } else if (particle.isWildcard()) {
        throw new IllegalStateException("TODO: Add support for wildcards");
      } else {
        throw new IllegalStateException("Invalid particle type");
      }
    }
View Full Code Here

      ComplexContentSG cct = pTypeSG.getComplexContentSG();
      GroupSG groupSG = cct.getGroupSG();
      ParticleSG[] childs = groupSG.getParticles();
      if (childs != null) {
        for (int i = 0;  i < childs.length;  i++) {
          ParticleSG child = childs[i];
          // Accept only simple elements
          if (child.isElement()) {
            ObjectSG objectSG = child.getObjectSG();
            if (!objectSG.getTypeSG().isComplex()) {
              allChilds.add(child);
            }
          }
        }
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.