Package org.apache.ws.jaxme.js

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


  protected int getState(int pParticleNum) { return pParticleNum; }

  private JavaField getChildNumField() {
    if (childNumField == null) {
      childNumField = getJavaSource().newJavaField("__childNum", int.class, JavaSource.PRIVATE);
      JavaComment jc = childNumField.newComment();
      jc.addLine("Index of the particle being currently parsed");
    }
    return childNumField;
  }
View Full Code Here


  }

  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.");
    jc.addLine("These are the indices, to which the child elements are");
    jc.addLine("mapped:");
    for (int i = 0;  i < particles.length;  i++) {
      ParticleSG particle = particles[i];
      if (particle.isGroup()) {
        GroupSG group = particle.getGroupSG();
        if (group.isGlobal()) {
          jc.addLine(" " + i + " = The nested group " + group.getName());
        } else {
          jc.addLine(" " + i + " = An anonymous nested group.");
        }
      } else if (particle.isElement()) {
        jc.addLine(" " + i + " = The child element " + particle.getObjectSG().getName());
      } else if (particle.isWildcard()) {
        throw new IllegalStateException("TODO: Add support for wildcards.");
      } else {
        throw new IllegalStateException("Invalid particle type.");
      }
View Full Code Here

          if (i > 0) {
            sb.append(", ");
            }
            sb.append(params[i].getType());
        }
        JavaComment comment = js.newComment();
        comment.addLine("Invoker for method " + pMethod.getName() + "(" + sb + ")");
        comment.addLine("in class " + pMethod.getJavaSource().getQName() + ".");
        js.setStatic(true);
        js.addImplements(pInvoker);
        JavaMethod jm = js.newJavaMethod("invoke", Object.class, JavaSource.PUBLIC);
        Parameter param = jm.addParam(Vector.class, "params");
        JavaQName[] classes = pMethod.getExceptions();
View Full Code Here

     */
    public JavaConstructor getDispatcherConstructor(JavaSource pSource,
                                                    JavaField pMap,
                                                    JavaQName pInvoker) {
        JavaConstructor con = pSource.newJavaConstructor(JavaSource.PUBLIC);
        JavaComment comment = con.newComment();
        comment.addLine("Creates a new dispatcher.");
        int num = 0;
        for (Iterator iter = methods.entrySet().iterator();  iter.hasNext()) {
            Map.Entry entry = (Map.Entry) iter.next();
            String name = (String) entry.getKey();
            JavaMethod method = (JavaMethod) entry.getValue();
View Full Code Here

    /** Creates the dispatchers <code>invoke</code> method.
     */
    protected JavaMethod getDispatcherInvokeMethod(JavaSource pSource, JavaQName pInvoker) {
        JavaMethod jm = pSource.newJavaMethod("execute", Object.class, JavaSource.PUBLIC);
        JavaComment comment = jm.newComment();
        comment.addLine("Called for invocation of method <code>pName</code> with");
        comment.addLine("the parameters given by <code>pParams</code>.");
        Parameter name = jm.addParam(String.class, "pName");
        Parameter args = jm.addParam(Vector.class, "pParams");
        jm.addThrows(Exception.class);
        LocalJavaField invoker = jm.newJavaField(pInvoker);
        invoker.addLine("getInvoker(", name, ")");
View Full Code Here

    public JavaSource getDispatcher(JavaQName pQName) {
      JavaSource js = getFactory().newJavaSource(pQName, JavaSource.PUBLIC);
        if (isDispatcherImplementsXmlRpcHandler()) {
          js.addImport(JavaQNameImpl.getInstance("org.apache.xmlrpc.XmlRpcHandler"));
        }
      JavaComment comment = js.newComment();
        comment.addLine("The dispatcher is being used by the XmlRpcServer.");
        comment.addLine("It delegates incoming XML-RPC calls to the classes");
        comment.addLine("and methods, for which client classes have been");
        comment.addLine("created by the " +
                        XmlRpcClientGenerator.class.getName() + ".");
        JavaSource invoker = getInvokerClass(js);
        JavaField map = getInvokerMap(js);
        getDispatcherConstructor(js, map, invoker.getQName());
        getGetInvokerMethod(js, invoker.getQName(), map);
View Full Code Here

    }
   
    JavaQName resultType = JavaQNameImpl.getInstance(Object[].class);
    JavaMethod jm = pSource.newJavaMethod("clone", resultType, JavaSource.PUBLIC);
    jm.addThrows(SQLException.class);
    JavaComment jc = jm.newComment();
    jc.addLine("<p>This method takes as input the key values of a row in the table " +
        headTable.getTable().getQName() + ".");
    jc.addLine("The key values are given by the array <code>pRow</code>:");
    jc.addLine("<ul>");
    int i = 0;
    for (Iterator iter = headTable.getTable().getPrimaryKey().getColumns();
        iter.hasNext();  i++) {
      Column col = (Column) iter.next();
      jc.addLine("  <li><code>pRow[" + i+ "] = " + col.getQName() + "</code></li>");
    }
    jc.addLine("</ul>");
    jc.addLine("The method updates the rows version number and creates a new row");
    jc.addLine("with the updated values.</p>");
    {
      Iterator iter = tablesByOrder.iterator();
      iter.next();
      if (iter.hasNext()) {
        jc.addLine("<p>Once the new row is created, the method searches for entries");
        jc.addLine("referencing the old row in the following tables:");
        jc.addLine("<table>");
        do {
          TableInfo subTable = (TableInfo) iter.next();
          jc.addLine("  <tr><td>" + subTable.getTable().getQName() + "</td></tr>");
        } while (iter.hasNext());
        jc.addLine("All the referencing entries are cloned as well, with updated");
        jc.addLine("references.");
      }
    }
   
    DirectAccessible conn = jm.addParam(Connection.class, "pConn");
    DirectAccessible row = jm.addParam(resultType, "pRow");
View Full Code Here

    /** Generates the abstract invoker class.
     */
    public JavaSource getInvokerClass(JavaSource pSource) {
        JavaInnerClass invoker = pSource.newJavaInnerClass("Invoker", JavaSource.PUBLIC);
        JavaComment comment = invoker.newComment();
        comment.addLine("The dispatcher is implemented with a {@link java.util.Map}.");
        comment.addLine("The map keys are the method names, the values");
        comment.addLine("are instances of <code>Invoker</code>.");
        invoker.setType(JavaSource.INTERFACE);
        JavaMethod jm = invoker.newJavaMethod("invoke", Object.class, JavaSource.PUBLIC);
        comment = jm.newComment();
        comment.addLine("This method creates a new instance of the class being");
        comment.addLine("called, converts the parameter objects (if required)");
        comment.addLine("and invokes the requested method. If required, the");
        comment.addLine("result is converted also and returned.");
        jm.addParam(Vector.class, "pParams");
        jm.addThrows(Throwable.class);
        return invoker;
    }
View Full Code Here

  protected int getState(int pParticleNum) { return pParticleNum; }

  private JavaField getChildNumField() {
    if (childNumField == null) {
      childNumField = getJavaSource().newJavaField("__childNum", int.class, JavaSource.PRIVATE);
      JavaComment jc = childNumField.newComment();
      jc.addLine("Index of the particle being currently parsed");
    }
    return childNumField;
  }
View Full Code Here

  }

  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.");
    jc.addLine("These are the indices, to which the child elements are");
    jc.addLine("mapped:");
    for (int i = 0;  i < particles.length;  i++) {
      ParticleSG particle = particles[i];
      if (particle.isGroup()) {
        GroupSG group = particle.getGroupSG();
        if (group.isGlobal()) {
          jc.addLine(" " + i + " = The nested group " + group.getName());
        } else {
          jc.addLine(" " + i + " = An anonymous nested group.");
        }
      } else if (particle.isElement()) {
        jc.addLine(" " + i + " = The child element " + particle.getObjectSG().getName());
      } else if (particle.isWildcard()) {
        throw new IllegalStateException("TODO: Add support for wildcards.");
      } else {
        throw new IllegalStateException("Invalid particle type.");
      }
View Full Code Here

TOP

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

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.