Package org.apache.ws.jaxme.js

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


    JavaMethod fromNameMethod = js.newJavaMethod("fromName", qName, JavaSource.PUBLIC);
    pName = fromNameMethod.addParam(String.class, "pName");
    fromNameMethod.setStatic(true);
    i = fromNameMethod.addForArray(instances);
    fromNameMethod.addIf(instances, "[", i, "].name.equals(", pName, ")");
    fromNameMethod.addLine("return ", instances, "[", i, "];");
    fromNameMethod.addEndIf();
    fromNameMethod.addEndFor();
    fromNameMethod.addThrowNew(IllegalArgumentException.class, JavaSource.getQuoted("Invalid name: "),
                                " + ", pName);
View Full Code Here


    newInstanceMethod.addLine("return ", jf, ".getManager(", pElementInterface, ").getElementJ();");

    {
      JavaMethod getPropertyMethod = js.newJavaMethod("getProperty", Object.class, "public");
      Parameter pName = getPropertyMethod.addParam(String.class, "pName");
      getPropertyMethod.addIf(properties, " == null");
      getPropertyMethod.addLine("return null;");
      getPropertyMethod.addEndIf();
      getPropertyMethod.addLine("return ", properties, ".get(", pName, ");");
    }
View Full Code Here

    {
      JavaMethod setPropertyMethod = js.newJavaMethod("setProperty", void.class, "public");
      Parameter pName = setPropertyMethod.addParam(String.class, "pName");
      Parameter pValue = setPropertyMethod.addParam(Object.class, "pValue");
      setPropertyMethod.addIf(properties, " == null");
      setPropertyMethod.addLine(properties, " = new ", HashMap.class, "();");
      setPropertyMethod.addEndIf();
      setPropertyMethod.addLine(properties, ".put(", pName, ", ", pValue, ");");
    }
View Full Code Here

        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, ")");
        jm.addIf(invoker, " == null");
        jm.addThrowNew(IllegalStateException.class,
                       JavaSource.getQuoted("Unknown method name: "),
                       " + ", name);
        jm.addEndIf();
        jm.addTry();
View Full Code Here

      LocalJavaField hashCodeResult = jm.newJavaField(int.class, "result");
      hashCodeResult.addLine(name, ".hashCode() + ", values, ".length;");
      DirectAccessible loopVar = jm.addForArray(values);
      LocalJavaField o = jm.newJavaField(Object.class, "o");
      o.addLine(values, "[", loopVar, "]");
      jm.addIf(o, " != null");
      jm.addLine(hashCodeResult, " += ", o, ".hashCode();");
      jm.addEndIf();
      jm.addEndFor();
      jm.addLine("return ", hashCodeResult, ";");
    }
View Full Code Here

    JavaMethod fromValueMethod = js.newJavaMethod("fromValue", qName, JavaSource.PUBLIC);
    pValue = fromValueMethod.addParam(valueType, "pValue");
    fromValueMethod.setStatic(true);
    DirectAccessible i = fromValueMethod.addForArray(instances);
    fromValueMethod.addIf(pController.getEqualsCheck(fromValueMethod, new Object[]{instances, "[", i, "].value"}, pValue));
    fromValueMethod.addLine("return ", instances, "[", i, "];");
    fromValueMethod.addEndIf();
    fromValueMethod.addEndFor();
    fromValueMethod.addThrowNew(IllegalArgumentException.class, JavaSource.getQuoted("Invalid value: "),
                                " + ", pValue);
View Full Code Here

    JavaMethod fromNameMethod = js.newJavaMethod("fromName", qName, JavaSource.PUBLIC);
    pName = fromNameMethod.addParam(String.class, "pName");
    fromNameMethod.setStatic(true);
    i = fromNameMethod.addForArray(instances);
    fromNameMethod.addIf(instances, "[", i, "].name.equals(", pName, ")");
    fromNameMethod.addLine("return ", instances, "[", i, "];");
    fromNameMethod.addEndIf();
    fromNameMethod.addEndFor();
    fromNameMethod.addThrowNew(IllegalArgumentException.class, JavaSource.getQuoted("Invalid name: "),
                                " + ", pName);
View Full Code Here

      element.addLine("(", elementInterface, ") result");
      Object s = new Object[]{"new ", String.class, "(", buffer, ", ",
                  offset, ", ", length, ")"};
      LocalJavaField list = jm.newJavaField(List.class);
      list.addLine(element, ".getContent()");
      jm.addIf(list, ".size() > 0");
      LocalJavaField o = jm.newJavaField(Object.class);
      o.addLine(list, ".get(", list, ".size()-1)");
      jm.addIf(o, " instanceof ", String.class);
      jm.addLine(list, ".set(", list, ".size()-1, ",
             "((", String.class, ") ", o, ") + ", s, ");");
View Full Code Here

      LocalJavaField list = jm.newJavaField(List.class);
      list.addLine(element, ".getContent()");
      jm.addIf(list, ".size() > 0");
      LocalJavaField o = jm.newJavaField(Object.class);
      o.addLine(list, ".get(", list, ".size()-1)");
      jm.addIf(o, " instanceof ", String.class);
      jm.addLine(list, ".set(", list, ".size()-1, ",
             "((", String.class, ") ", o, ") + ", s, ");");
      jm.addLine("return;");
      jm.addEndIf();
      jm.addEndIf();
View Full Code Here

    }

    JavaMethod jm = js.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

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.