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

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


      return;
    }
    for (int i = pFrom;  i <= pTo;  i++) {
      ParticleSG particle = particles[i];
      if (particle.isElement()) {
        ObjectSG oSG = particle.getObjectSG();
        XsQName name = oSG.getName();
        Object uriCondition;
        if ("".equals(name.getNamespaceURI())) {
          uriCondition = new Object[]{"(", getParamNamespaceURI(),
              " == null  ||  ",
              getParamNamespaceURI(),
View Full Code Here


  }

  private void handleEndElementState(JavaMethod pJm, LocalJavaField pElement,
                     ParticleSG pParticle) throws SAXException {
    if (pParticle.isElement()) {
      ObjectSG oSG = pParticle.getObjectSG();
      TypeSG childType = oSG.getTypeSG();
      XsQName name = oSG.getName();
      Object[] uriCondition;
      if ("".equals(name.getNamespaceURI())) {
        uriCondition = new Object[]{
          getParamNamespaceURI(), " == null  ||  ",
          getParamNamespaceURI(), ".length() == 0"
        };
      } else {
        uriCondition = new Object[]{
          JavaSource.getQuoted(name.getNamespaceURI()), ".equals(",
          getParamNamespaceURI(), ")"
        };
      }
      pJm.addIf(uriCondition, "  &&  ", JavaSource.getQuoted(name.getLocalName()),
          ".equals(", getParamLocalName(), ")");
      JavaQName type;
      TypedValue v = getParamResult();
      if (childType.isComplex()) {
        type = childType.getComplexTypeSG().getClassContext().getXMLInterfaceName();
        if (isMixed) {
          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();
          PropertySGChain head = new PropertySGChainImpl(chain){
            public String getXMLFieldName(PropertySG pController) throws SAXException {
              return "_value";
            }
            public String getPropertyName(PropertySG pController) throws SAXException {
              return "value";
            }
          };
          pSG = new PropertySGImpl(head);
          element = f;
        } else {
          pSG = pParticle.getPropertySG();
          element = pElement;
        }
        createSimpleTypeConversion(pJm, childType, v,
                       oSG.getName().toString(),
                       pSG, element);
        if (isMixed) {
          pJm.addLine(pElement, ".getContent().add(", element, ");");
        }
      }
View Full Code Here

      }
    } else {
      elementSG.generate(pJs);
    }

    ObjectSG oSG = pParticle.getObjectSG();
    TypeSG typeSG = oSG.getTypeSG();
    if (!typeSG.isGlobalType()  &&  !typeSG.isGlobalClass()  &&  typeSG.isComplex()) {
      ComplexTypeSG complexTypeSG = typeSG.getComplexTypeSG();
      if (pJs.isInterface()) {
        complexTypeSG.getXMLInterface(pJs);
      } else {
View Full Code Here

        JavaSource.getQuoted(pObjectSG.getName().getLocalName()), ", ",
        value, ");");
  }

  public void simpleElementParticle(GroupSG pGroup, ParticleSG pParticle) throws SAXException {
    final ObjectSG oSG = pParticle.getObjectSG();
    if (isMixed) {
      JavaQName interfaceName = ctSG.getClassContext().getXMLInterfaceName();
      JavaQName qName = GroupUtil.getContentClass(pGroup, pParticle, interfaceName);
      if (mixedTypesMap.contains(qName)) {
        return;
View Full Code Here

        ", ", JavaSource.getQuoted(pObjectSG.getName().getLocalName()),
        ", ", pValue, ");");
  }

  public void complexElementParticle(GroupSG pGroup, ParticleSG pParticle) throws SAXException {
    final ObjectSG oSG = pParticle.getObjectSG();
    if (isMixed) {
      JavaQName qName = oSG.getTypeSG().getComplexTypeSG().getClassContext().getXMLInterfaceName();
      if (mixedTypesMap.contains(qName)) {
        return;
      }
      mixedTypesMap.add(qName);
      jm.addElseIf(object, " instanceof ", qName);
View Full Code Here

            String name = p.getPropertySG().getXMLFieldName();
            for (int j = i+1;  j < elementParticles.size();  j++) {
                Particle qParticle = elementParticleArray[j];
                ParticleSG q = qParticle.getParticleSG();
                if (name.equals(q.getPropertySG().getXMLFieldName())) {
                    ObjectSG pObject = p.getObjectSG();
                    ObjectSG qObject = q.getObjectSG();
                    if (!pObject.isGlobal()  ||  !qObject.isGlobal()  ||
                        pObject != qObject) {
                        throw new SAXParseException("Multiple element particles named " + name
                                                    + ", which aren't references to "
                                                    + " a common global element, are present in a common"
                                                    + " complex type. (JAXB 1.0, 5.9.7.4.a) Use jaxb:property/@name"
View Full Code Here

        if (groupSG == null) {
          throw new IllegalStateException("GroupSG not created");
        }
        groups.add(groupSG);
      } else if (o instanceof XSElement) {
        ObjectSG objectSG = pController.getElement(((XSElement) o).getName());
        if (objectSG == null) {
          throw new IllegalStateException("ObjectSG not created");
        }
        objects.add(objectSG);
        elements.add(objectSG);
View Full Code Here

  public ObjectSG[] getObjects(SchemaSG pController) throws SAXException {
    return objectsByOrder;
  }

  public ObjectSG getElement(SchemaSG pController, XsQName pName) throws SAXException {
    ObjectSG objectSG = (ObjectSG) elementsByName.get(pName);
    if (objectSG != null) {
      return objectSG;
    }
    XSElement element = getXSSchema().getElement(pName);
    if (element == null) {
View Full Code Here

    for (Iterator iter = pContextList.iterator();  iter.hasNext()) {
      Object o = iter.next();
      Context ctx, typeCtx;
      if (o instanceof ObjectSG) {
      ObjectSG oSG = (ObjectSG) o;
      ctx = oSG.getClassContext();
      typeCtx = oSG.getTypeSG().getComplexTypeSG().getClassContext();
      } else {
      TypeSG tSG = (TypeSG) o;
      ctx = typeCtx = tSG.getComplexTypeSG().getClassContext();
      }
View Full Code Here

    Set contextSet = new HashSet();
    for (Iterator iter = pContextList.iterator();  iter.hasNext()) {
      Object o = iter.next();
      TypeSG typeSG;
      if (o instanceof ObjectSG) {
        ObjectSG objectSG = ((ObjectSG) o);
        typeSG = objectSG.getTypeSG();
        generateCreateMethod(js, null, objectSG.getClassContext());
        //NB: we don't have to check for duplicate element names since that would violate the XSD spec
      } else if (o instanceof TypeSG) {
        typeSG = (TypeSG) o;
      } else {
        continue;
View Full Code Here

TOP

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

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.