Package org.apache.ws.jaxme.js

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


    jm.addLine(query, " = ", JavaSource.getQuoted("SELECT DISTINCT"), ";");
    jm.addElse();
    jm.addLine(query, " = ", JavaSource.getQuoted("SELECT"), ";");
    jm.addEndIf();
    jm.addLine(query, " += ", JavaSource.getQuoted(" " + sb + " FROM " + table.getQName()), ";");
    jm.addIf(pQuery, " != null");
    jm.addLine(query, " += ", JavaSource.getQuoted(" WHERE "), " + ", pQuery, ";");
    jm.addEndIf();

    LocalJavaField connection = jm.newJavaField(Connection.class);
    connection.addLine("null");
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

    jm.addSwitch(pLevelVar, "++");
    jm.addCase("0");
   
    jm.addLine("setResult(newResult());");
    jm.addIf(pAttr, " != null");
   
    String iVar = jm.getLocalVariableName();
    jm.addFor("int ", iVar, " = 0;  ", iVar, " < pAttr.getLength();  ", iVar, "++");
    AttributeSG[] myAttributes = pController.getAttributes();
    if (myAttributes.length == 0) {
View Full Code Here

      JavaMethod jm = pSource.newJavaMethod("characters", void.class, JavaSource.PUBLIC);
      Parameter buffer = jm.addParam(char[].class, "pChars");
      Parameter offset = jm.addParam(int.class, "pOffset");
      Parameter length = jm.addParam(int.class, "pLength");
      jm.addThrows(SAXException.class);
      jm.addIf(pLevelVar, " == 1");
      jm.addLine("__content.append(", buffer, ", ", offset, ", ", length, ");");
      jm.addEndIf();
      return jm;
  }
View Full Code Here

    if (uris.isEmpty()) {
      return null;
    }
    JavaMethod jm = pSource.newJavaMethod("getPreferredPrefix", String.class, JavaSource.PUBLIC);
    DirectAccessible pURI = jm.addParam(String.class, "pURI");
    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();
    jm.addLine("return super.getPreferredPrefix(", pURI, ");");
View Full Code Here

      element.addLine("(", elementInterface, ") ", pElement);
      LocalJavaField chars = jm.newJavaField(String.class);
      SimpleContentSG simpleContent = pController.getSimpleContentSG();
      Object value = simpleContent.getPropertySG().getValue(element);
      chars.addLine(simpleContent.getContentTypeSG().getSimpleTypeSG().getCastToString(jm, value, pData));
        jm.addIf(chars, ".length() > 0");
      LocalJavaField charArray = jm.newJavaField(char[].class);
      charArray.addLine(chars, ".toCharArray()");
      jm.addLine(pData, ".getContentHandler().characters(", charArray, ", 0, ", charArray, ".length);");
        jm.addEndIf();
      return jm;
View Full Code Here

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

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.