Examples of JavaComment


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", true));
        }
      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

  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++) {
        jc.addLine(" " + (3+i) + " = While parsing the child element " + myParticles[i].getObjectSG().getName());
      }

      JavaMethod[] methods = pSource.getMethods();
      boolean ok = false;
      for (int i = 0;  i < methods.length;  i++) {
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

   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

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

  public JavaSourceBuilder(JavaSourceFactory factory, String clazz, CompilerOptions options) {
    this.options = options;
    this.factory = factory;
    source = factory.newJavaSource(JavaQNameImpl.getInstance(clazz));
    source.setProtection(JavaSource.PUBLIC);
    JavaComment comment = null;
    if(options.getBanner()!=null) {
      comment = source.newComment();
      comment.addLine("");
      JavaSourceUtils.addComment(comment, options.getBanner());
    }
    if(options.getLicence()!=null) {
      if(comment==null) {
        comment = source.newComment();
      }
      comment.addLine("");
      JavaSourceUtils.addComment(comment, options.getLicence());
    }
  }
View Full Code Here

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

      }
  }

  public JavaMethod getXMLGetMethod(PropertySG pController, JavaSource pSource) throws SAXException {
      JavaMethod jm = pSource.newJavaMethod(pController.getXMLGetMethodName(), String.class, JavaSource.PUBLIC);
      JavaComment jc = jm.newComment();
      jc.addLine("<p>Returns the value of the 'anyAttribute' named <code>pName</code>.</p>");
      jc.addLine("@return Attribute value or null, if the attribute is not set.");
      jc.addLine("@throws NullPointerException The <code>pName</code> argument is null.");
      if (!namespaceList.isAny()) {
          jc.addLine("@throws IllegalArgumentException The namespace <code>pName.getNamespaceURI()</code> is invalid.");
      }
      Parameter pName = jm.addParam(QName.class, "pName");
      if (!pSource.isInterface()) {
        jm.addIf(pName, " == null");
        jm.addThrowNew(NullPointerException.class, JavaSource.getQuoted("The pName argument must not be null."));
View Full Code Here

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

      return jm;
  }

  public JavaMethod getXMLSetMethod(PropertySG pController, JavaSource pSource) throws SAXException {
      JavaMethod jm = pSource.newJavaMethod(pController.getXMLSetMethodName(), void.class, JavaSource.PUBLIC);
      JavaComment jc = jm.newComment();
      jc.addLine("<p>Sets the 'anyAttribute' named <code>pName</code> to the value <code>pValue</code>.</p>");
      if (!namespaceList.isAny()) {
          jc.addLine("@throws IllegalArgumentException The namespace <code>pName.getNamespaceURI()</code> is invalid.");
      }
      jc.addLine("@throws NullPointerException Either of the arguments <code>pName</code> or <code>pValue</code> is null.");
      Parameter pName = jm.addParam(QName.class, "pName");
      Parameter pValue = jm.addParam(String.class, "pValue");
      if (!pSource.isInterface()) {
        jm.addIf(pName, " == null");
        jm.addThrowNew(NullPointerException.class, JavaSource.getQuoted("The pName argument must not be null."));
View Full Code Here

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

      return jm;
  }

  public JavaMethod getXMLUnsetMethod(PropertySG pController, JavaSource pSource) throws SAXException {
      JavaMethod jm = pSource.newJavaMethod("un" + pController.getXMLSetMethodName(), boolean.class, JavaSource.PUBLIC);
      JavaComment jc = jm.newComment();
      jc.addLine("<p>Removes the 'anyAttribute' named <code>pName</code>.</p>");
      if (!namespaceList.isAny()) {
          jc.addLine("@throws IllegalArgumentException The namespace <code>pName.getNamespaceURI()</code> is invalid.");
      }
      jc.addLine("@throws NullPointerException Either of the arguments <code>pName</code> or <code>pValue</code> is null.");
      jc.addLine("@return True, if the attribute was set, otherwise false.");
      Parameter pName = jm.addParam(QName.class, "pName");
      if (!pSource.isInterface()) {
        jm.addIf(pName, " == null");
        jm.addThrowNew(NullPointerException.class, JavaSource.getQuoted("The pName argument must not be null."));
        jm.addEndIf();
View Full Code Here

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

      return jm;
  }

  public JavaMethod getXMLGetArrayMethod(PropertySG pController, JavaSource pSource) throws SAXException {
      JavaMethod jm = pSource.newJavaMethod(pController.getXMLGetMethodName() + "Array", WildcardAttribute[].class, JavaSource.PUBLIC);
      JavaComment jc = jm.newComment();
      jc.addLine("<p>Returns the array of 'anyAttributes'.</p>");
      LocalJavaField size = jm.newJavaField(int.class);
      size.addLine(pController.getXMLFieldName(), ".size()");
      LocalJavaField result = jm.newJavaField(jm.getType());
      result.addLine("new ", WildcardAttribute.class, "[", size, "]");
      DirectAccessible iter = jm.addForCollection(new Object[]{pController.getXMLFieldName(), ".entrySet()"});
View Full Code Here

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

  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++) {
          ParticleSG particle = myParticles[i];
          if (particle.isGroup()) {
              // TODO: process group case properly.
              continue;
          } else if (particle.isElement()) {
              jc.addLine(" " + (3+i) + " = While parsing the child element " + myParticles[i].getObjectSG().getName());
          } else if (particle.isWildcard()) {
              jc.addLine(" " + (3+i) + " = While parsing the wildcard");
          } else {
              throw new IllegalStateException("Invalid particle type.");
          }
      }
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.