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

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


  private void elementParticle(GroupSG pGroupSG, ParticleSG pParticle) throws SAXException {
    if (isInheritedParticle(pParticle)) {
      return;
    }
    final JavaSource pJs = this.js;
    final PropertySG elementSG = pParticle.getPropertySG();
    if (isMixed) {
      JavaQName qName = GroupUtil.getContentClass(pGroupSG, pParticle, pJs.getQName());
      JavaSource js;
      if (qName.isInnerClass()) {
        js = pJs.newJavaInnerClass(qName.getInnerClassName(), JavaSource.PUBLIC);
        if (!pJs.isInterface()) {
          js.setStatic(true);
        }
      } else {
        js = pJs.getFactory().newJavaSource(qName, JavaSource.PUBLIC);
      }
      if (pJs.isInterface()) {
        js.setType(JavaSource.INTERFACE);
      } else {
        js.addImplements(GroupUtil.getContentClass(pGroupSG, pParticle, ct.getClassContext().getXMLInterfaceName()));
      }
      PropertySGChain chain = ((PropertySGImpl) elementSG).getHeadOfChain();
      PropertySGChain head = new PropertySGChainImpl(chain){
        public String getXMLFieldName(PropertySG pController) throws SAXException {
          return "_value";
        }
        public String getPropertyName(PropertySG pController) throws SAXException {
          return "value";
        }
      };
      PropertySGImpl pSG = new PropertySGImpl(head);
      pSG.generate(js);
    } else {
      elementSG.generate(pJs);
    }

    ObjectSG oSG = pParticle.getObjectSG();
    TypeSG typeSG = oSG.getTypeSG();
    if (!typeSG.isGlobalType()  &&  !typeSG.isGlobalClass()  &&  typeSG.isComplex()) {
View Full Code Here


            return;
        }
        Particle[] particles = getLocalElementParticles(pController);
        for (int i = 0;  i < elementParticleArray.length;  i++) {
      ParticleSG particle = particles[i].getParticleSG();
            PropertySG elementSG = particle.getPropertySG();
      elementSG.generate(pSource);
        }
        log.finest(mName, "<-");
    }
View Full Code Here

          pJm.addLine(pElement, ".getContent().add(", v, ");");
        } else {
          pParticle.getPropertySG().addValue(pJm, pElement, v, type);
        }
      } else {
        PropertySG pSG;
        DirectAccessible element;
        if (isMixed) {
          LocalJavaField f = pJm.newJavaField(GroupUtil.getContentClass(group, pParticle, ctSG.getClassContext().getXMLInterfaceName()));
          f.addLine("new ", GroupUtil.getContentClass(group, pParticle, ctSG.getClassContext().getXMLImplementationName()), "()");
          PropertySGChain chain = ((PropertySGImpl) pParticle.getPropertySG()).getHeadOfChain();
View Full Code Here

  private void elementParticle(GroupSG pGroupSG, ParticleSG pParticle) throws SAXException {
    if (isInheritedParticle(pParticle)) {
      return;
    }
    final JavaSource pJs = this.js;
    final PropertySG elementSG = pParticle.getPropertySG();
    if (isMixed) {
      if (!pParticle.getObjectSG().getTypeSG().isComplex()) {
        JavaQName qName = GroupUtil.getContentClass(pGroupSG, pParticle, pJs.getQName());
        JavaSource js;
        if (qName.isInnerClass()) {
          js = pJs.newJavaInnerClass(qName.getInnerClassName(), JavaSource.PUBLIC);
          if (!pJs.isInterface()) {
            js.setStatic(true);
          }
        } else {
          js = pJs.getFactory().newJavaSource(qName, JavaSource.PUBLIC);
        }
        if (pJs.isInterface()) {
          js.setType(JavaSource.INTERFACE);
        } else {
          js.addImplements(GroupUtil.getContentClass(pGroupSG, pParticle, ct.getClassContext().getXMLInterfaceName()));
        }
        PropertySGChain chain = ((PropertySGImpl) elementSG).getHeadOfChain();
        PropertySGChain head = new PropertySGChainImpl(chain){
          public String getXMLFieldName(PropertySG pController) throws SAXException {
            return "_value";
          }
          public String getPropertyName(PropertySG pController) throws SAXException {
            return "value";
          }
        };
        PropertySGImpl pSG = new PropertySGImpl(head);
        pSG.generate(js);
      }
    } else {
      elementSG.generate(pJs);
    }

    ObjectSG oSG = pParticle.getObjectSG();
    TypeSG typeSG = oSG.getTypeSG();
    if (!typeSG.isGlobalType()  &&  !typeSG.isGlobalClass()  &&  typeSG.isComplex()) {
View Full Code Here

            throw new IllegalStateException("A new PropertySGChain cannot be obtained.");
        }
        if (maxOccurs > ||  maxOccurs == -1) {
      // Dirty trick: We do not yet have the PropertySG available,
      // so we fake one.
      PropertySG pSG = new PropertySGImpl(result);
      if ("indexed".equals(pSG.getCollectionType())) {
        result = new ArrayPropertySG(result, objectSG, minOccurs, maxOccurs);
      } else {
        result = new MultiplePropertySG(result, objectSG, minOccurs, maxOccurs);
      }
        }
View Full Code Here

    }

    public void forAllNonNullValues(ParticleSG pController, JavaMethod pMethod,
                  DirectAccessible pElement, SGlet pSGlet) throws SAXException {
        if (pController.isElement()) {
            PropertySG pSG = pController.getPropertySG();
            boolean hasIsSetMethod = pSG.hasIsSetMethod();
            if (hasIsSetMethod) {
                pMethod.addIf(pSG.getXMLIsSetMethodName(), "()");
            }
            TypeSG typeSG = pController.getObjectSG().getTypeSG();
            Object v = pController.getPropertySG().getValue(pElement);
            if (typeSG.isComplex()) {
                pSGlet.generate(pMethod, v);
View Full Code Here

            throw new IllegalStateException("A new PropertySGChain cannot be obtained.");
        }
        if (maxOccurs > ||  maxOccurs == -1) {
      // Dirty trick: We do not yet have the PropertySG available,
      // so we fake one.
      PropertySG pSG = new PropertySGImpl(result);
      if ("indexed".equals(pSG.getCollectionType())) {
        result = new ArrayPropertySG(result, objectSG, minOccurs, maxOccurs);
      } else {
        result = new MultiplePropertySG(result, objectSG, minOccurs, maxOccurs);
      }
        }
View Full Code Here

    }

    public void forAllNonNullValues(ParticleSG pController, JavaMethod pMethod,
                  DirectAccessible pElement, SGlet pSGlet) throws SAXException {
        if (pController.isElement()) {
            PropertySG pSG = pController.getPropertySG();
            boolean hasIsSetMethod = pSG.hasIsSetMethod();
            if (hasIsSetMethod) {
                pMethod.addIf(pSG.getXMLIsSetMethodName(), "()");
            }
            TypeSG typeSG = pController.getObjectSG().getTypeSG();
            Object v = pController.getPropertySG().getValue(pElement);
            if (typeSG.isComplex()) {
                pSGlet.generate(pMethod, v);
View Full Code Here

            return;
        }
        Particle[] particles = getLocalElementParticles(pController);
        for (int i = 0;  i < elementParticleArray.length;  i++) {
      ParticleSG particle = particles[i].getParticleSG();
            PropertySG elementSG = particle.getPropertySG();
      elementSG.generate(pSource);
        }
        log.finest(mName, "<-");
    }
View Full Code Here

    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");
      }
    }
    log.finest(mName, "<-");
View Full Code Here

TOP

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

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.