Package org.apache.ws.jaxme.js

Examples of org.apache.ws.jaxme.js.JavaMethod.addLine()


   getValue.addLine("return ", value, ";");

   JavaMethod getInstances = pSource.newJavaMethod("getInstances", arrayType,
                                                  JavaSource.PUBLIC);
   getInstances.setStatic(true);
   getInstances.addLine("return ", allInstances, ";");

   JavaMethod getInstanceByName = pSource.newJavaMethod("getInstanceByName",
                                                       pSource.getQName(),
                                                       JavaSource.PUBLIC);
    getInstanceByName.setStatic(true);
View Full Code Here


   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);
View Full Code Here

   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: "),
View Full Code Here

     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",
View Full Code Here

   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];
    Object[] args = new Object[]{JavaSource.getQuoted(item.getValue()), " == s"};
    getInstanceByValue.addIf(first, args);
View Full Code Here

   first = true;
   for (int i = 0;  i < pItems.length;  i++) {
    Item item = pItems[i];
    Object[] args = new Object[]{JavaSource.getQuoted(item.getValue()), " == s"};
    getInstanceByValue.addIf(first, args);
    getInstanceByValue.addLine("return ", item.getName(), ";");
    first = false;
   }
   getInstanceByValue.addElse();
   getInstanceByValue.addLine("throw new ", IllegalArgumentException.class, "(",
                      JavaSource.getQuoted("Invalid name: "),
View Full Code Here

    getInstanceByValue.addIf(first, args);
    getInstanceByValue.addLine("return ", item.getName(), ";");
    first = false;
   }
   getInstanceByValue.addElse();
   getInstanceByValue.addLine("throw new ", IllegalArgumentException.class, "(",
                      JavaSource.getQuoted("Invalid name: "),
                      " + pValue);");
   getInstanceByValue.addEndIf();

   if (isAddingEquals()) {
View Full Code Here

   if (isAddingEquals()) {
     JavaMethod equals = pSource.newJavaMethod("equals", JavaQNameImpl.BOOLEAN,
                                               JavaSource.PUBLIC);
     equals.addParam(Object.class, "o");
     equals.addIf("o == null  ||  !(o instanceof ", pSource.getQName(), ")");
     equals.addLine("return false;");
     equals.addEndIf();
     equals.addLine("return name.equals(((", pSource.getQName(), ") o).name);");

      JavaMethod hashCode = pSource.newJavaMethod("hashCode", JavaQNameImpl.INT,
                                                  JavaSource.PUBLIC);
View Full Code Here

                                               JavaSource.PUBLIC);
     equals.addParam(Object.class, "o");
     equals.addIf("o == null  ||  !(o instanceof ", pSource.getQName(), ")");
     equals.addLine("return false;");
     equals.addEndIf();
     equals.addLine("return name.equals(((", pSource.getQName(), ") o).name);");

      JavaMethod hashCode = pSource.newJavaMethod("hashCode", JavaQNameImpl.INT,
                                                  JavaSource.PUBLIC);
      hashCode.addLine("return name.hashCode();");
   }
View Full Code Here

     equals.addEndIf();
     equals.addLine("return name.equals(((", pSource.getQName(), ") o).name);");

      JavaMethod hashCode = pSource.newJavaMethod("hashCode", JavaQNameImpl.INT,
                                                  JavaSource.PUBLIC);
      hashCode.addLine("return name.hashCode();");
   }
  }
}
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.