Package org.apache.ws.jaxme.js

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


      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


    names.add(itemName);
    names.add(itemValue);
   }

   pSource.addImplements(Serializable.class);
   JavaField name = pSource.newJavaField("name", String.class, JavaSource.PRIVATE);
   name.setFinal(true);
   JavaField value = pSource.newJavaField("value", String.class, JavaSource.PRIVATE);
   name.setFinal(true);
   JavaConstructor jcon = pSource.newJavaConstructor(JavaSource.PRIVATE);
   jcon.addParam(String.class, "pName");
   jcon.addParam(String.class, "pValue");
   jcon.addLine("name = pName;");
   jcon.addLine("value = pValue;");
    List instanceList = new ArrayList();
   for (int i = 0;  i < pItems.length;  i++) {
      Item item = pItems[i];
    String itemName = item.getName();
    String itemValue = item.getValue();
    JavaField instance = pSource.newJavaField(itemName, pSource.getQName(),
                                             JavaSource.PUBLIC);
    instance.newComment().addLine("The enumeration item with name " + itemName +
                                 " and value " + itemValue + ".");
    instance.setStatic(true);
    instance.setFinal(true);
    instance.addLine("new ", pSource.getQName(), "(", JavaSource.getQuoted(itemName),
                     ", ", JavaSource.getQuoted(itemValue), ")");

    if (i > 0) instanceList.add(", ");
     instanceList.add(instance);
    }

   JavaQName arrayType = JavaQNameImpl.getArray(pSource.getQName());
   JavaField allInstances = pSource.newJavaField("allInstances", arrayType,
                                                  JavaSource.PRIVATE);
   allInstances.setStatic(true);
   allInstances.setFinal(true);
   allInstances.addLine("new ", arrayType, "{", instanceList, "}");

   JavaMethod getName = pSource.newJavaMethod("getName", String.class,
                                               JavaSource.PUBLIC);
   getName.newComment().addLine("The enumeration items name.");
   getName.addLine("return ", name, ";");
View Full Code Here

  private int fromState(int pState) {
    return pState-1;
  }

  protected JavaField newStateField() throws SAXException {
    JavaField jf = getJavaSource().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");
    for (int i = 0;  i < particles.length;  i++) {
      ParticleSG particle = particles[i];
      if (particle.isGroup()) {
View Full Code Here

  protected JavaMethod getGetMixedContentMethod() {
    if (mixedContentMethod == null) {
      JavaSource js = getJavaSource();
      JavaMethod jm = js.newJavaMethod("getContent", List.class, JavaSource.PUBLIC);
      if (!js.isInterface()) {
        JavaField mixedContentList = getJavaSource().newJavaField("content", List.class, JavaSource.PRIVATE);
        mixedContentList.setFinal(true);
        mixedContentList.addLine("new ", ArrayList.class, "()");
        jm.addLine("return ", mixedContentList, ";");
      }
    }
    return mixedContentMethod;
  }
View Full Code Here

    result.addLine("return ", o, ";");
    return result;
  }

  protected JavaField newStateField() throws SAXException {
    JavaField jf = getJavaSource().newJavaField("__state", boolean.class, JavaSource.PRIVATE);
    JavaComment jc = jf.newComment();
    jc.addLine("Will be set to true, if the first child is parsed.");
    jc.addLine("It is an error, if another child is parsed, and the");
    jc.addLine("fields value is true.");
    return jf;
  }
View Full Code Here

    }
    return result;
  }

  protected JavaField newStateField() throws SAXException {
    JavaField jf = getJavaSource().newJavaField("__state", boolean[].class, JavaSource.PRIVATE);
    jf.addLine("new ", boolean.class, "[" + particles.length + "]");
    JavaComment jc = jf.newComment();
    jc.addLine("This array indicates the state of the group. For any");
    jc.addLine("possible child, the corresponding boolean value is set,");
    jc.addLine("if the child is parsed.");
    jc.addLine("If the same child occurs again, and the childs boolean");
    jc.addLine("value is true, then an exception is thrown.");
View Full Code Here

        JavaQName typeQName = getQName(typeName);
        return pSource.newJavaField(fieldName, typeName, JavaSource.DEFAULT_PROTECTION);
    }

    private void parseFieldDefinition(JavaSource pSource, AST pAST) {
      JavaField jf = getJavaField(pSource, pAST);
        parseModifiers(jf, pAST);
    }
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

  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

        }
        return jm;
    }

    protected JavaField getXmlRpcCaller(JavaSource pJs) {
      JavaField jf = pJs.newJavaField("caller", XmlRpcCaller.class, JavaSource.PRIVATE);
        jf.setFinal(true);
        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.