Examples of JavaComment


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

    /** 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

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

    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

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

    }
   
    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

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

    /** 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

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

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

  }

  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

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

  }

  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

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

    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

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

    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()) {
        GroupSG group = particle.getGroupSG();
        if (group.isGlobal()) {
          jc.addLine(" " + getState(i) + " = While parsing the nested group " + group.getName());
        } else {
          jc.addLine(" " + getState(i) + " = While parsing the nested group " + GroupUtil.getGroupName(group));
        }
      } else if (particle.isElement()) {
        jc.addLine(" " + getState(i) + " = While or after parsing 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

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

   JavaMethod getInstanceByName = pSource.newJavaMethod("getInstanceByName",
                                                       pSource.getQName(),
                                                       JavaSource.PUBLIC);
    getInstanceByName.setStatic(true);
   getInstanceByName.addParam(String.class, "pName");
   JavaComment jc = getInstanceByName.newComment();
   jc.addLine("Returns the item with the given name.</p>");
   jc.addThrows(IllegalArgumentException.class.getName() +
               " The name <code>pName</code> is invalid and no such item exists.");
   getInstanceByName.addLine(String.class, " s = pName.intern();");
   boolean first = true;
   for (int i = 0;  i < pItems.length;  i++) {
    Item item = pItems[i];
    Object[] args = new Object[]{JavaSource.getQuoted(item.getName()), " == s"};
     getInstanceByName.addIf(first, args);
     getInstanceByName.addLine("return ", item.getName(), ";");
     first = false;
   }
   getInstanceByName.addElse();
   getInstanceByName.addLine("throw new ", IllegalArgumentException.class, "(",
                             JavaSource.getQuoted("Invalid name: "),
                              " + pName);");
   getInstanceByName.addEndIf();

   JavaMethod getInstanceByValue = pSource.newJavaMethod("getInstanceByValue",
                                       pSource.getQName(),
                                       JavaSource.PUBLIC);
   getInstanceByValue.setStatic(true);
   getInstanceByValue.addParam(String.class, "pValue");
   jc = getInstanceByValue.newComment();
   jc.addLine("Returns the item with the given value.</p>");
   jc.addThrows(IllegalArgumentException.class.getName() +
            " The name <code>pValue</code> is invalid and no such item exists.");
   getInstanceByValue.addLine(String.class, " s = pValue.intern();");
   first = true;
   for (int i = 0;  i < pItems.length;  i++) {
    Item item = pItems[i];
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.