Package org.apache.ws.jaxme.js

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


        if (jUri == null) { jUri = ""; }
        if (!uri.equals(jUri)) {
          continue;
        }
       
        jm.addIf(firstInNamespace, JavaSource.getQuoted(attr.getName().getLocalName()), ".equals(", pLocalName, ")");
        firstInNamespace = false;
        Object v = myAttributes[i].getTypeSG().getSimpleTypeSG().getCastFromString(jm, pValue, "getData()");
        attr.getPropertySG().setValue(jm, result, v, null);
        jm.addLine("return;");
      }
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("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

    Set uris = createSetOfExplicitURIs(myAttributes);
    boolean first = true;
    for (Iterator iter = uris.iterator();  iter.hasNext()) {
      String uri = (String) iter.next();
      jm.addIf(first, JavaSource.getQuoted(uri), ".equals(", pURI, ")");
      first = false;
      boolean firstInNamespace = true;
      for (int i = 0;  i < myAttributes.length;  i++) {
        AttributeSG attr = myAttributes[i];
        if (attr.isWildcard()) {
View Full Code Here

        if (jUri == null) { jUri = ""; }
        if (!uri.equals(jUri)) {
          continue;
        }
       
        jm.addIf(firstInNamespace, JavaSource.getQuoted(attr.getName().getLocalName()), ".equals(", pLocalName, ")");
        firstInNamespace = false;
        TypedValue v = createSimpleTypeConversion(jm, myAttributes[i].getTypeSG(), pValue, "@" + myAttributes[i].getName());
        attr.getPropertySG().setValue(jm, result, v, null);
        jm.addLine("return;");
      }
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 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

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.