Package org.apache.ws.jaxme.js

Examples of org.apache.ws.jaxme.js.JavaQName


    jm.addSwitch("--", pLevelVar);
    jm.addCase("0");
    jm.addBreak();
    jm.addCase("1");
    JavaQName elementInterface = pController.getClassContext().getXMLInterfaceName();
    LocalJavaField element = jm.newJavaField(elementInterface);
    element.addLine("(", elementInterface, ") getResult()");
    jm.addSwitch(pStateVar);
    for (int i = 0;  i < myParticles.length;  i++) {
      ParticleSG child = myParticles[i];
      ObjectSG osg = child.getObjectSG();
      TypeSG childType = osg.getTypeSG();
      jm.addCase(Integer.toString(3+i));
      jm.addIf(pHandlerVar, " != null");
      jm.addLine(pHandlerVar, ".endDocument();");
      jm.addEndIf();
      Object v;
      JavaQName type;
      if (childType.isComplex()) {
        type = childType.getComplexTypeSG().getClassContext().getXMLInterfaceName();
        v = new Object[]{pHandlerVar, ".getResult()"};
      } else {
        type = null;
View Full Code Here


      String pName = "p" + Character.toUpperCase(pFieldName.charAt(0)) + pFieldName.substring(1);
      JavaMethod jm = pSource.newJavaMethod(pMethodName, JavaQNameImpl.VOID, JavaSource.PUBLIC);
      DirectAccessible param = jm.addParam(pController.getRuntimeType(), pName);
      if (!pSource.isInterface()) {
        jm.addLine(pFieldName, " = ", param, ";");
        JavaQName checkQName = pController.getRuntimeType();
        boolean isPrimitive = "".equals(checkQName.getPackageName());
        if (isPrimitive) {
          String checkFieldName = "has" + Character.toUpperCase(pFieldName.charAt(0)) + pFieldName.substring(1);
          jm.addLine(checkFieldName, " = true;");
        }
      }
View Full Code Here

  public JavaMethod getXMLIsSetMethod(TypeSG pController, JavaSource pSource,
    String pFieldName, String pMethodName) throws SAXException {
    JavaMethod jm = pSource.newJavaMethod(pMethodName, BooleanSG.BOOLEAN_TYPE, JavaSource.PUBLIC);
    if (!pSource.isInterface()) {
      JavaQName checkQName = pController.getRuntimeType();
      boolean isPrimitive = "".equals(checkQName.getPackageName());
      if (isPrimitive) {
        String checkFieldName = "has" + Character.toUpperCase(pFieldName.charAt(0)) + pFieldName.substring(1);
        pSource.newJavaField(checkFieldName, BooleanSG.BOOLEAN_TYPE);
        jm.addLine("return " + checkFieldName + ";");
      } else {
View Full Code Here

      getObjectFactory(pController, packageName, contextList);
    }
  }

  protected JavaSource getObjectFactory(SchemaSG pController, String pPackageName, List pContextList) {
    JavaQName qName = JavaQNameImpl.getInstance(pPackageName, "ObjectFactory");
    JavaSource js = pController.getJavaSourceFactory().newJavaSource(qName, "public");
    JavaField jf = js.newJavaField("jaxbContext", JAXBContextImpl.class, "private");
    JavaField properties = js.newJavaField("properties", Map.class, "private");

    JavaConstructor jcon = js.newJavaConstructor("public");
    jcon.addThrows(JAXBException.class);
    jcon.addLine(jf, " = (", JAXBContextImpl.class, ") ",
                 JAXBContext.class, ".newInstance(",
                 JavaSource.getQuoted(pPackageName), ");");

    JavaMethod newInstanceMethod = js.newJavaMethod("newInstance", Object.class, "public");
    newInstanceMethod.addThrows(JAXBException.class);
    Parameter pElementInterface = newInstanceMethod.addParam(Class.class, "pElementInterface");
    newInstanceMethod.addLine("return ", jf, ".getElement(", pElementInterface, ");");

    {
      JavaMethod getPropertyMethod = js.newJavaMethod("getProperty", Object.class, "public");
      Parameter pName = getPropertyMethod.addParam(String.class, "pName");
      getPropertyMethod.addIf(properties, " == null");
      getPropertyMethod.addLine("return null;");
      getPropertyMethod.addEndIf();
      getPropertyMethod.addLine("return ", properties, ".get(", pName, ");");
    }

    {
      JavaMethod setPropertyMethod = js.newJavaMethod("setProperty", void.class, "public");
      Parameter pName = setPropertyMethod.addParam(String.class, "pName");
      Parameter pValue = setPropertyMethod.addParam(Object.class, "pValue");
      setPropertyMethod.addIf(properties, " == null");
      setPropertyMethod.addLine(properties, " = new ", HashMap.class, "();");
      setPropertyMethod.addEndIf();
      setPropertyMethod.addLine(properties, ".put(", pName, ", ", pValue, ");");
    }

    for (Iterator iter = pContextList.iterator();  iter.hasNext()) {
      Object o = iter.next();
      if (!(o instanceof ObjectSG)) {
        continue;
      }
      ObjectSG objectSG = (ObjectSG) o;
      TypeSG typeSG = objectSG.getTypeSG();
      if (!typeSG.isComplex()) {
        continue;
      }
      ComplexTypeSG complexTypeSG = typeSG.getComplexTypeSG();

      JavaQName resultName = complexTypeSG.getClassContext().getXMLInterfaceName();
      String className = resultName.getClassName();
      String methodName = "create" + Character.toUpperCase(className.charAt(0)) + className.substring(1);
      JavaMethod createMethod = js.newJavaMethod(methodName, resultName, "public");
      createMethod.addThrows(JAXBException.class);
      createMethod.addLine("return (", resultName, ") newInstance(", resultName, ".class);");
    }
View Full Code Here

  }

  public JavaSource getXMLInterface(ComplexTypeSG pController) throws SAXException {
    final String mName = "getXMLInterface";
    log.finest(mName, "->");
    JavaQName qName = pController.getClassContext().getXMLInterfaceName();
    JavaSourceFactory jsf = pController.getTypeSG().getSchema().getJavaSourceFactory();
    JavaSource js = jsf.newJavaSource(qName, JavaSource.PUBLIC);
    js.setType(JavaSource.INTERFACE);

    generateProperties(pController, js);
View Full Code Here

  }

  public JavaSource getXMLInterface(ComplexTypeSG pController, JavaSource pSource) throws SAXException {
    final String mName = "getXMLInterface(JavaSource)";
    log.finest(mName, "->", pSource.getQName());
    JavaQName qName = pController.getClassContext().getXMLInterfaceName();
    JavaSource js = pSource.newJavaInnerClass(qName.getClassName(), JavaSource.PUBLIC);
    js.setType(JavaSource.INTERFACE);

    generateProperties(pController, js);
    if (!pController.hasSimpleContent()) {
      GroupSG groupSG = pController.getComplexContentSG().getGroupSG();
View Full Code Here

  }

  public JavaSource getXMLSerializer(ComplexTypeSG pController) throws SAXException {
    final String mName = "getXMLSerializer";
    log.finest(mName, "->", typeSG.getName());
    JavaQName xmlSerializerName = pController.getClassContext().getXMLSerializerName();
    JavaSourceFactory jsf = typeSG.getSchema().getJavaSourceFactory();
    JavaSource js = jsf.newJavaSource(xmlSerializerName, JavaSource.PUBLIC);
    js.addExtends(JMXmlSerializerImpl.class);
    pController.generateXMLSerializerMethods(js);
    return js;
View Full Code Here

  }

  public JavaSource getXMLHandler(ComplexTypeSG pController) throws SAXException {
    final String mName = "getXMLHandler";
    log.finest(mName, "->", typeSG.getName());
    JavaQName xmlSerializerName = pController.getClassContext().getXMLHandlerName();
    JavaSourceFactory jsf = typeSG.getSchema().getJavaSourceFactory();
    JavaSource js = jsf.newJavaSource(xmlSerializerName, JavaSource.PUBLIC);
    js.addExtends(JMHandlerImpl.class);
    pController.generateXMLHandlerMethods(js);
    return js;
View Full Code Here

    DirectAccessible pData = jm.addParam(JavaQNameImpl.getInstance(JMXmlSerializer.Data.class), "pData");
    DirectAccessible pElement = jm.addParam(Object.class, "pElement");
    jm.addThrows(SAXException.class);
    LocalJavaField result = jm.newJavaField(AttributesImpl.class);
    result.addLine("super.getAttributes(", pData, ", ", pElement, ")");
    JavaQName elementInterface = pController.getClassContext().getXMLInterfaceName();
    LocalJavaField element = jm.newJavaField(elementInterface);
    element.addLine("(", elementInterface, ") ", pElement);

    AttributeSG[] myAttributes = pController.getAttributes();
    XMLSerializerAttributeSGlet sgLet = new XMLSerializerAttributeSGlet(result, pData);
View Full Code Here

    jm.addThrows(SAXException.class);
    jm.addIf(pURI, " == null");
    jm.addLine(pURI, " = \"\";");
    jm.addEndIf();

    JavaQName resultType = pController.getClassContext().getXMLInterfaceName();
    LocalJavaField result = jm.newJavaField(resultType);
    result.addLine("(", resultType, ") getResult()");

    Set uris = new HashSet();
    for (int i = 0;  i < myAttributes.length;  i++) {
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.js.JavaQName

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.