Package org.apache.ws.jaxme.js

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


  protected JavaSource getObjectFactory(SchemaSG pController, String pPackageName,
                      List pContextList)
      throws SAXException {
    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(",
View Full Code Here


      while (js.isInnerClass()) {
        js = ((JavaInnerClass) js).getOuterClass();
      }
      JavaField[] fields = js.getFields();
      JavaQName qName = JavaQNameImpl.getInstance(DatatypeConverterInterface.class);
      JavaField converter = null;
      for (int i = 0;  i < fields.length;  i++) {
        if (qName.equals(fields[i].getType())  &&  JavaSource.DEFAULT_PROTECTION.equals(fields[i].getProtection())  &&
            fields[i].isStatic()  &&  fields[i].isFinal()) {
          converter = fields[i];
          break;
        }
      }
      if (converter == null) {
        converter = js.newJavaField("__dataTypeConverter", qName);
        converter.setStatic(true);
        converter.setFinal(true);
        converter.addLine("new ", DatatypeConverterImpl.class, "()");
      }
      value = new Object[]{converter, ".parse" + getDatatypeName() + "(", pValue, ")"};
    } else {
      value = new Object[]{pData, ".getDatatypeConverter().parse" + getDatatypeName() + "(", pValue, ")"};
    }
View Full Code Here

        jm.addThrows(JAXBException.class);
      }
      String serializerName = getXMLSerializersFieldName(particle.getPropertySG());
      Context myClassContext = child.getTypeSG().getComplexTypeSG().getClassContext();
      JavaQName serializerClass = myClassContext.getXMLSerializerName();
      JavaField jf = pSource.newJavaField(serializerName, serializerClass, JavaSource.PRIVATE);
      JavaQName elementInterface = myClassContext.getXMLInterfaceName();
      if (child.getTypeSG().isGlobalClass()) {
        jm.addLine(jf, " = (", serializerClass, ") ", pFactory, ".getJMXmlSerializer(", elementInterface, ".class);");
      } else {
        jm.addLine(jf, " = new ", serializerClass, "();");
View Full Code Here

          String f = particle.getPropertySG().getXMLFieldName();
          String handlerFieldName = "__handler_" + f;
          String handlerMethodName = getXMLHandlersMethodName(particle.getPropertySG());

          JavaField jf = pSource.newJavaField(handlerFieldName, JMHandler.class, JavaSource.PRIVATE);
          JavaMethod jm2 = pSource.newJavaMethod(handlerMethodName, JMHandler.class, "protected");
          jm2.addThrows(SAXException.class);
          jm2.addIf(handlerFieldName, " == null");
         
          ComplexTypeSG childSG = typeSG.getComplexTypeSG();
View Full Code Here

  }

  private JavaField getXMLHandlersStateField(GroupSG pController, JavaSource pSource) throws SAXException {
    ParticleSG[] myParticles = pController.getParticles();
    if (myParticles.length > 0) {
      JavaField jf = pSource.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");
      jc.addLine(" 1 = Parsing an unknown element");
      jc.addLine(" 2 = After parsing the element");
      for (int i = 0;  i < myParticles.length;  i++) {
View Full Code Here

  }

  private JavaField getXMLHandlersHandlerField(GroupSG pController, JavaSource pSource) throws SAXException {
    ParticleSG[] myParticles = pController.getParticles();
    if (myParticles.length > 0) {
      JavaField jf = pSource.newJavaField("__handler", JMHandler.class, JavaSource.PRIVATE);
      jf.newComment().addLine("The current handler for parsing child elements or simple content.");
      return jf;
    }
    return null;

  }
View Full Code Here

    return jm;
  }

  public void generateXMLHandlersElements(GroupSG pController, JavaSource pSource, DirectAccessible pLevelVar)
      throws SAXException {
    JavaField stateVar = getXMLHandlersStateField(pController, pSource);
    JavaField handlerVar = getXMLHandlersHandlerField(pController, pSource);
    extendXMLHandlersStartDocumentMethod(pController, pSource, stateVar, handlerVar);
    extendXMLHandlersStartElementMethod(pController, pSource, stateVar, handlerVar);
    getXMLHandlersEndElementMethod(pController, pSource, pLevelVar, stateVar, handlerVar);
    getXMLHandlersCharactersMethod(pController, pSource, handlerVar);
    getXMLHandlersElements(pController, pSource);
View Full Code Here

          "), ", pAttr, ".getValue(", iVar, "));");     
    }
    jm.addEndFor();
    jm.addEndIf();
    if (pController.hasSimpleContent()) {
        JavaField jf = pSource.newJavaField("__content", StringBuffer.class, JavaSource.PRIVATE);
        jm.addLine(jf, " = new ", StringBuffer.class, "();");
    }
    jm.addBreak();
   
    if (pController.hasSimpleContent()) {
View Full Code Here

   
    return jm;
  }
 
  private JavaField getXMLHandlersLevelField(ComplexTypeSG pController, JavaSource pSource) {
    JavaField jf = pSource.newJavaField("__level", int.class, JavaSource.PRIVATE);
    jf.newComment().addLine("The current level of nested elements. 0, if outside the root element.");
    return jf;
  }
View Full Code Here

      jm.addEndIf();
      return jm;
  }

  public void generateXMLHandlerMethods(ComplexTypeSG pController, JavaSource pSource) throws SAXException {
    JavaField levelVar = getXMLHandlersLevelField(pController, pSource);
    getXMLHandlersStartDocumentMethod(pController, pSource, levelVar);
    getXMLHandlersAddAttributeMethod(pController, pSource);
    getXMLHandlersNewResultMethod(pController, pSource);
    getXMLHandlersStartElementMethod(pController, pSource, levelVar);
    getXMLHandlersEndElementMethod(pController, pSource, levelVar);
View Full Code Here

TOP

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

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.