Package org.apache.ws.jaxme.js

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


      jm.addIf(v, " == null");
      jm.addIf(other, ".values[", loopVar, "] != null");
      jm.addLine("return false;");
      jm.addEndIf();
      jm.addElse();
      jm.addIf("!", v, ".equals(", other, ".values[", loopVar, "])");
      jm.addLine("return false;");
      jm.addEndIf();
      jm.addEndIf();
      jm.addEndFor();
      jm.addLine("return true;");
View Full Code Here


   
    LocalJavaField baseKey = null;
    if (table.getPrimaryKey() != null) {
      baseKey = getCacheDataClassInstance(jm, pTableInfo,
          table.getPrimaryKey(), values);
      jm.addIf(map, ".containsKey(", baseKey, ")");
      logFinestExiting(jm, JavaSource.getQuoted("null (Already cloned)"));
      jm.addLine("return null;");
      jm.addEndIf();
    }
   
View Full Code Here

    jm.addLine(stmt, ".executeUpdate();");
    jm.addLine(isStmtClosed, " = true;");
    jm.addLine(stmt, ".close();");
   
    jm.addFinally();
    jm.addIf("!", isStmtClosed);
    jm.addTry();
    jm.addLine(stmt, ".close();");
    jm.addCatch(Throwable.class, "ignore");
    jm.addEndTry();
    jm.addEndIf();
View Full Code Here

    String methodName = pController.getXMLSetMethodName();
    JavaMethod result = pSource.newJavaMethod(methodName, "void", JavaSource.PUBLIC);
    Parameter array = result.addParam(arrayClass, "pValue");
    if (!pSource.isInterface()) {
      result.addLine(fieldName, ".clear();");
      result.addIf(array, " != null");
      DirectAccessible i = result.addForArray(int.class, array);
      Object o = new Object[]{array, "[", i, "]"};
      result.addLine(fieldName, ".add(", asObject(o), ");");
      result.addEndFor();
      result.addEndIf();
View Full Code Here

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

   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);
    getInstanceByValue.addLine("return ", item.getName(), ";");
    first = false;
   }
   getInstanceByValue.addElse();
   getInstanceByValue.addLine("throw new ", IllegalArgumentException.class, "(",
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,
View Full Code Here

    }

    JavaMethod jm = getJavaSource().newJavaMethod("getPreferredPrefix", String.class, JavaSource.PUBLIC);
    DirectAccessible pURI = jm.addParam(String.class, "pURI");
    if (!uris.isEmpty()) {
      jm.addIf(pURI, " == null");
      jm.addLine(pURI, " = \"\";");
      jm.addEndIf();
      boolean first = true;
      for (Iterator iter = uris.entrySet().iterator();  iter.hasNext()) {
        Map.Entry entry = (Map.Entry) iter.next();
View Full Code Here

      boolean first = true;
      for (Iterator iter = uris.entrySet().iterator();  iter.hasNext()) {
        Map.Entry entry = (Map.Entry) iter.next();
        String uri = (String) entry.getKey();
        String prefix = (String) entry.getValue();
        jm.addIf(first, pURI, ".equals(", JavaSource.getQuoted(uri), ")");
        jm.addLine("return ", JavaSource.getQuoted(prefix), ";");     
        first = false;
      }
      jm.addEndIf();
    }
View Full Code Here

    JavaMethod jm = getJavaSource().newJavaMethod("addAttribute", JavaQNameImpl.VOID, JavaSource.PUBLIC);
    DirectAccessible pURI = jm.addParam(String.class, "pURI");
    DirectAccessible pLocalName = jm.addParam(String.class, "pLocalName");
    DirectAccessible pValue = jm.addParam(String.class, "pValue");
    jm.addThrows(SAXException.class);
    jm.addIf(pURI, " == null");
    jm.addLine(pURI, " = \"\";");
    jm.addEndIf();
   
    JavaQName resultType = ctSG.getClassContext().getXMLInterfaceName();
    LocalJavaField result = jm.newJavaField(resultType);
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.