Examples of JavaComment


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

    JavaQName type = f.getType();
    if(type.getPackageName().startsWith("java")) {
      try {
        // we suppose java types are good boys, willing to work quietly
        JavaMethod method = js.newJavaMethod(getMethodName(f), getFieldInformerType(type));
        JavaComment comment = method.newComment();
        comment.addLine("");
        comment.addLine("Gets the FieldInformer associated to "+f.getName()+
            ". its type has been defined according to FieldInformerLocator current implementation code.");
        comment.addSee(f.getJavaSource().getQName().toString()+"#"+f.getName());
      } catch(NoInformerForThisType e) {
        logger.log(Level.FINE, "unable to find an informer for field "+f.toString()+" of class "+sourceClass.getClassName(), e);
      }
    }
  }
View Full Code Here

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

    factory.setOverwriteForced(true);
    // Let the factory create a Java source class
    // "com.mycompany.demo.Parser"
    JavaQName className = getBusinessInformer(sourceClass.getQName());
    JavaSource js = factory.newJavaSource(className, "public");
    JavaComment comment = js.newComment();
    comment.addLine("");
    comment.addLine("Define improved Informer for "+sourceClass.getClassName()+".");
    comment.addLine("Elements of this method allows easier usage of improved gaedo finders.");
    comment.addLine("The instances of FieldInformer used for that class various fields have been chosen according to FieldInformerLocator current implementation.");
    comment.addLine("As a consequence, the behaviour of this method has guaranteed comaptibilty with most of gaedo code");
    comment.addLine("");
    comment.addLine("@see "+sourceClass.getQName().toString());
    comment.addSee(JavaQNameImpl.getInstance(FieldInformer.class).toString());
    comment.addSee(JavaQNameImpl.getInstance(FieldInformerLocator.class).toString());
    comment.addAuthor("created by gaedo-informer generator on "+format.format(new Date()));
    js.setDynamicImports(true);
    js.setType(js.INTERFACE);
    js.setProtection(js.PUBLIC);
    js.addExtends(Informer.class);
    JavaField[] fields = sourceClass.getFields();
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

  }

  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

  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

          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

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

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