Package org.apache.ws.jaxme.js

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


          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

        }
      }
      else {
        runtimeType = pController.getRuntimeType();
      }
      JavaField jf = pSource.newJavaField(pFieldName, runtimeType, JavaSource.PRIVATE);
      if (!pController.isComplex()) {
        Object o = pController.getSimpleTypeSG().getInitialValue(pSource);
        if (o == null && pDefaultValue != null) {
          if (runtimeType.equals(StringSG.STRING_TYPE)) {
            o = "\"" + pDefaultValue + "\"";
          }
          else {
            o = pDefaultValue;
          }
        }
        if (o != null) {
          jf.addLine(o);
        }
      }
      return jf;
    }
  }
View Full Code Here

    return maxOccurs == -||  maxOccurs > 1;
  }

  public JavaField getXMLField(PropertySG pController, JavaSource pSource) throws SAXException {
    String fieldName = pController.getXMLFieldName();
    JavaField result = pSource.newJavaField(fieldName, List.class, JavaSource.PRIVATE);
    result.addLine("new ", ArrayList.class, "()");
    return result;
  }
View Full Code Here

    JavaQName qNameArray = JavaQNameImpl.getArray(qName);

    JavaSource js = pController.getSchema().getJavaSourceFactory().newJavaSource(qName, JavaSource.PUBLIC);
    js.addImplements(Serializable.class);

    JavaField name = js.newJavaField("name", String.class, JavaSource.PRIVATE);
    name.setFinal(true);
    JavaField value = js.newJavaField("value", valueType, JavaSource.PRIVATE);
    value.setFinal(true);
    JavaField lexicalValue = js.newJavaField("lexicalValue", String.class, JavaSource.PRIVATE);
    lexicalValue.setFinal(true);

    List instanceParams = new ArrayList();
    for (int i = 0;  i < values.length;  i++) {
      JavaField _f = js.newJavaField("_" + values[i].getName(), String.class, JavaSource.PUBLIC);
      _f.setStatic(true);
      _f.setFinal(true);
      _f.addLine(JavaSource.getQuoted(values[i].getName()));

      JavaField f = js.newJavaField(values[i].getName(), qName, JavaSource.PUBLIC);
      f.addLine("new ", qName, "(", JavaSource.getQuoted(values[i].getName()), ", ",
                super.getCastFromString(pController, values[i].getValue()), ", ",
                JavaSource.getQuoted(values[i].getValue()), ");");
      f.setStatic(true);
      f.setFinal(true);
      if (!instanceParams.isEmpty()) instanceParams.add(", ");
      instanceParams.add(f);
    }
    JavaField instances = js.newJavaField("instances", qNameArray, JavaSource.PRIVATE);
    instances.addLine(new Object[]{"new ", qNameArray, "{", instanceParams, "}"});
    instances.setStatic(true);
    instances.setFinal(true);

    JavaConstructor con = js.newJavaConstructor(JavaSource.PRIVATE);
    DirectAccessible pName = con.addParam(String.class, "pName");
    DirectAccessible pValue = con.addParam(super.getRuntimeType(pController), "pValue");
    DirectAccessible pLexicalValue = con.addParam(String.class, "pLexicalValue");
View Full Code Here

      // No need to generate the types XML implementation; this is done by the schema.
    } else {
      complexTypeSG.generateXMLImplementationMethods(js);
    }

    JavaField myName = js.newJavaField("__qName", QName.class, JavaSource.PRIVATE);
    myName.setStatic(true);
    myName.setFinal(true);
    XsQName qName = pController.getName();
    String prefix = qName.getPrefix();
    if (prefix == null) {
      myName.addLine("new ", QName.class, "(", JavaSource.getQuoted(qName.getNamespaceURI()),
                     ", ", JavaSource.getQuoted(qName.getLocalName()), ")");
    } else {
        myName.addLine("new ", QName.class, "(", JavaSource.getQuoted(qName.getNamespaceURI()),
                     ", ", JavaSource.getQuoted(qName.getLocalName()), ", ",
             JavaSource.getQuoted(prefix), ")");
    }

    JavaMethod getQName = js.newJavaMethod("getQName", QName.class, JavaSource.PUBLIC);
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

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.