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

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


      throws SAXException {
    if (pParticle.isGroup()) {
      GroupSG group = pParticle.getGroupSG();
      generateCreateMethods(pJs, group.getParticles(), pName, pContextSet);
    } else if (pParticle.isElement()) {
      ObjectSG oSG = pParticle.getObjectSG();
      if (oSG.isGlobal()) {
        return// Will be generated elsewhere
      }
      TypeSG tSG = oSG.getTypeSG();
      if (tSG.isGlobalType()) {
        return// Will be generated elsewhere
      }
      generateCreateMethod(pJs, pContextSet, tSG, pName);
    } else if (pParticle.isWildcard()) {
View Full Code Here


    ObjectSG[] elements = jschema.getElements();
    assertNotNull(elements);
    assertEquals(2, elements.length);

    ObjectSG ea = elements[0];
    assertTrue(ea.getTypeSG().isComplex());
    ComplexTypeSG eact = ea.getTypeSG().getComplexTypeSG();
    AttributeSG[] eactAttr = eact.getAttributes();
    assertEquals(3, eactAttr.length);
    assertEquals(new XsQName((String) null, "d"), eactAttr[0].getName());
    assertEquals(eactAttr[0].getTypeSG().getSimpleTypeSG().getRuntimeType(), JavaQNameImpl.getInstance(Calendar.class));
    assertEquals(new XsQName((String) null, "e"), eactAttr[1].getName());
    assertEquals(eactAttr[1].getTypeSG().getSimpleTypeSG().getRuntimeType(), JavaQNameImpl.getInstance(float.class));
    assertEquals(new XsQName((String) null, "a"), eactAttr[2].getName());
    assertEquals(eactAttr[2].getTypeSG().getSimpleTypeSG().getRuntimeType(), JavaQNameImpl.getInstance(String.class));

    ObjectSG eb = elements[1];
    assertTrue(eb.getTypeSG().isComplex());
    ComplexTypeSG ebct = eb.getTypeSG().getComplexTypeSG();
    AttributeSG[] ebctAttr = ebct.getAttributes();
    assertEquals(5, ebctAttr.length);
    assertEquals(new XsQName((String) null, "g"), ebctAttr[0].getName());
    assertEquals(ebctAttr[0].getTypeSG().getSimpleTypeSG().getRuntimeType(), JavaQNameImpl.getInstance(double.class));
    assertEquals(new XsQName((String) null, "d"), ebctAttr[1].getName());
View Full Code Here

    SchemaSG jschema = parse(schema, "testElements.xsd");

    ObjectSG[] elements = jschema.getElements();
    assertEquals(4, elements.length);

    ObjectSG e1 = elements[0];
    assertEquals(new XsQName((String) null, "a"), e1.getName());
    TypeSG t1 = e1.getTypeSG();
    assertTrue(!t1.isComplex());
    assertTrue(t1.getSimpleTypeSG().isAtomic());
    assertEquals(t1.getSimpleTypeSG().getRuntimeType(), JavaQNameImpl.getInstance(String.class));

    ObjectSG e2 = elements[1];
    assertEquals(new XsQName((String) null, "b"), e2.getName());
    TypeSG t2 = e2.getTypeSG();
    assertTrue(!t2.isComplex());
    SimpleTypeSG st2 = t2.getSimpleTypeSG();
    assertTrue(st2.isAtomic());
    assertEquals(JavaQNameImpl.getInstance(float.class), st2.getRuntimeType());

    ObjectSG e3 = elements[2];
    assertEquals(new XsQName((String) null, "c"), e3.getName());
    TypeSG t3 = e3.getTypeSG();
    assertTrue(t3.isComplex());
    ComplexTypeSG ct3 = t3.getComplexTypeSG();
    assertTrue(!ct3.hasSimpleContent());
    ComplexContentSG cct3 = ct3.getComplexContentSG();
    ParticleSG[] childs = cct3.getGroupSG().getParticles();
    assertEquals(2, childs.length);
    assertTrue(childs[0].isElement());
    ObjectSG child1 = childs[0].getObjectSG();
    assertEquals(new XsQName((String) null, "a"), child1.getName());
    assertTrue(childs[1].isElement());
    ObjectSG child2 = childs[1].getObjectSG();
    assertEquals(new XsQName((String) null, "d"), child2.getName());
    assertTrue(!child2.getTypeSG().isComplex());
    SimpleTypeSG st4 = child2.getTypeSG().getSimpleTypeSG();
    assertEquals(JavaQNameImpl.getInstance(double.class.getName()), st4.getRuntimeType());
    AttributeSG[] attributes = ct3.getAttributes();
    assertEquals(1, attributes.length);
    assertEquals(new XsQName((String) null, "e"), attributes[0].getName());
    assertTrue(!attributes[0].getTypeSG().isComplex());

    ObjectSG e4 = elements[3];
    assertTrue(e4.getTypeSG().isComplex());
    ComplexTypeSG ct4 = e4.getTypeSG().getComplexTypeSG();
    assertTrue(ct4.hasSimpleContent());
    SimpleContentSG sct4 = ct4.getSimpleContentSG();
    assertTrue(!sct4.getContentTypeSG().isComplex());
    assertEquals(JavaQNameImpl.getInstance(int.class), sct4.getContentTypeSG().getRuntimeType());
    assertEquals(1, ct4.getAttributes().length);
View Full Code Here

   
    SchemaSG jschema = parse(schema, "testFacets.xsd");

    ObjectSG[] elements = jschema.getElements();
    assertEquals(1, elements.length);
    ObjectSG se1 = elements[0];
    assertEquals(new XsQName((String) null, "a"), se1.getName());
    assertTrue(!se1.getTypeSG().isComplex());
    SimpleTypeSG sst1 = se1.getTypeSG().getSimpleTypeSG();
    assertEquals(JavaQNameImpl.getInstance(String.class), sst1.getRuntimeType());
    Facet facet = sst1.getFacet(Facet.ENUMERATION);
    assertNotNull(facet);
    String[] values = facet.getValues();
    assertNotNull(values);
View Full Code Here

    // purchaseOrder
    // <xsd:element name='purchaseOrder' type='PurchaseOrderType'/>
    ObjectSG[] elements = jschema.getElements();
    assertNotNull(elements);
    assertEquals(2, elements.length);
    ObjectSG purchaseOrder = elements[1];
    assertEquals(new XsQName((String) null, "purchaseOrder"), purchaseOrder.getName());
    assertTrue(purchaseOrder.getTypeSG().isComplex());
    assertTrue(purchaseOrder.getTypeSG().isGlobalType());
    assertEquals(new XsQName((String) null, "PurchaseOrderType"), purchaseOrder.getTypeSG().getName());
  }
View Full Code Here

      "</xsd:schema> \n";

    SchemaSG jschema = parse(schema, "testRestrictionMaxExclusive.xsd");
    ObjectSG[] elements = jschema.getElements();
    assertEquals(1, elements.length);
    ObjectSG quantity = elements[0];
    String maxExclusive = quantity.getTypeSG().getSimpleTypeSG().getAtomicType().getMaxExclusive();
    assertNotNull(maxExclusive);
    assertEquals("100", maxExclusive);
  }
View Full Code Here

    return particleSG.getMinOccurs() > 0;
  }

  protected void handleStartOfChildElement(Object pUnmarshallerHandler,
                       JavaMethod pJm, ParticleSG pParticle) {
    ObjectSG oSG = pParticle.getObjectSG();
    TypeSG tSG = oSG.getTypeSG();
    if (tSG.isComplex()) {
      JavaQName elementInterfaceClass = pParticle.getObjectSG().getClassContext().getXMLInterfaceName();
      Object[] o, h;
      if (oSG.getClassContext().isGlobal()) {
        LocalJavaField manager = pJm.newJavaField(JMManager.class);
        manager.addLine("getHandler().getJMUnmarshaller().getJAXBContextImpl().getManagerS(",
            elementInterfaceClass, ".class)");
        o = new Object[]{manager, ".getElementS();"};
        h = new Object[]{manager, ".getHandler();"};
      } else {
        Context context = oSG.getClassContext();
        o = new Object[]{" new ", context.getXMLImplementationName(), "()"};
        h = new Object[]{" new ", context.getXMLHandlerName(), "()"};
      }
      LocalJavaField oField = pJm.newJavaField(Object.class);
      oField.addLine(o);
      LocalJavaField hField = pJm.newJavaField(JMSAXElementParser.class);
      hField.addLine(h);
      XsQName name = oSG.getName();
      pJm.addLine(hField, ".init(", pUnmarshallerHandler, ", ", oField, ", ",
          JavaSource.getQuoted(name.getNamespaceURI()), ", ",
          JavaSource.getQuoted(name.getLocalName()),
      ", ", pUnmarshallerHandler, ".getLevel());");
      pJm.addLine(hField, ".setAttributes(", getParamAttrs(), ");");
View Full Code Here

      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"
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

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.