Package org.apache.ws.jaxme.js

Examples of org.apache.ws.jaxme.js.JavaInnerClass


    }

    /** Generates the abstract invoker class.
     */
    public JavaSource getInvokerClass(JavaSource pSource) {
        JavaInnerClass invoker = pSource.newJavaInnerClass("Invoker", JavaSource.PUBLIC);
        JavaComment comment = invoker.newComment();
        comment.addLine("The dispatcher is implemented with a {@link java.util.Map}.");
        comment.addLine("The map keys are the method names, the values");
        comment.addLine("are instances of <code>Invoker</code>.");
        invoker.setType(JavaSource.INTERFACE);
        JavaMethod jm = invoker.newJavaMethod("invoke", Object.class, JavaSource.PUBLIC);
        comment = jm.newComment();
        comment.addLine("This method creates a new instance of the class being");
        comment.addLine("called, converts the parameter objects (if required)");
        comment.addLine("and invokes the requested method. If required, the");
        comment.addLine("result is converted also and returned.");
View Full Code Here


    /** Creates a new invoker class for the given method.
     */
    protected JavaSource getInvoker(JavaSource pSource, JavaMethod pMethod, JavaQName pInvoker, int pNum) {
        Parameter[] params = pMethod.getParams();

        JavaInnerClass js = pSource.newJavaInnerClass("Invoker" + pNum, JavaSource.PUBLIC);
        StringBuffer sb = new StringBuffer();
        for (int i = 0;  i < params.length;  i++) {
          if (i > 0) {
            sb.append(", ");
            }
            sb.append(params[i].getType());
        }
        JavaComment comment = js.newComment();
        comment.addLine("Invoker for method " + pMethod.getName() + "(" + sb + ")");
        comment.addLine("in class " + pMethod.getJavaSource().getQName() + ".");
        js.setStatic(true);
        js.addImplements(pInvoker);
        JavaMethod jm = js.newJavaMethod("invoke", Object.class, JavaSource.PUBLIC);
        Parameter param = jm.addParam(Vector.class, "params");
        JavaQName[] classes = pMethod.getExceptions();
        for (int i = 0;  i < classes.length;  i++) {
          jm.addThrows(classes[i]);
        }
View Full Code Here

      return;
    }
    CustomTableData customTableData = (CustomTableData) pController.getProperty(jdbcSG.getKey());
    if (customTableData != null) {
      JavaQName qName = pController.getComplexTypeSG().getClassContext().getPMName();
      JavaInnerClass jic = pSource.newJavaInnerClass(qName.getClassName());
      getPMClass(pController, jic, customTableData);
    }
  }
View Full Code Here

  }

  /** <p>Generates the innner class CacheData.</p>
   */
  protected JavaInnerClass getCacheDataClass(JavaSource pSource) {
     JavaInnerClass jic = pSource.newJavaInnerClass("CacheData", JavaSource.PRIVATE);

     JavaField name = jic.newJavaField("name", String.class, JavaSource.PRIVATE);
     name.setFinal(true);
     JavaField values = jic.newJavaField("values", Object[].class, JavaSource.PRIVATE);
     values.setFinal(true);

     JavaConstructor jcon = jic.newJavaConstructor(JavaSource.PRIVATE);
     DirectAccessible pName = jcon.addParam(String.class, "pName");
     DirectAccessible pValues = jcon.addParam(Object[].class, "pValues");
     jcon.addLine(name, " = ", pName, ";");
     jcon.addLine(values, " = ", pValues, ";");

     JavaMethod getNameMethod = jic.newJavaMethod("getName", String.class, JavaSource.PUBLIC);
     getNameMethod.addLine("return ", name, ";");

     JavaMethod getValuesMethod = jic.newJavaMethod("getValues", Object[].class, JavaSource.PUBLIC);
     getValuesMethod.addLine("return ", values, ";");

     {
       JavaMethod jm = jic.newJavaMethod("toString", String.class, JavaSource.PUBLIC);
       LocalJavaField sb = jm.newJavaField(StringBuffer.class, "sb");
       sb.addLine("new ", StringBuffer.class, "(", name, ")");
       DirectAccessible loopVar = jm.addForArray(values);
       jm.addLine(sb, ".append(", JavaSource.getQuoted(", "), ").append(",
                  values, "[", loopVar, "]);");
       jm.addEndFor();
       jm.addLine("return ", sb, ".toString();");

     }

     {
       JavaMethod jm = jic.newJavaMethod("hashCode", int.class, JavaSource.PUBLIC);
       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, ";");
     }

     {
       JavaMethod jm = jic.newJavaMethod("equals", boolean.class, JavaSource.PUBLIC);
       DirectAccessible o = jm.addParam(Object.class, "o");
       jm.addIf(o, " == null  ||  !(", o, " instanceof ", jic.getQName(), ")");
       jm.addLine("return false;");
       jm.addEndIf();
       LocalJavaField other = jm.newJavaField(jic.getQName(), "other");
       other.addLine("(", jic.getQName(), ") ", o);
       jm.addIf("!", name, ".equals(", other, ".name)  ||  ", values, ".length != ",
                other, ".values.length");
       jm.addLine("return false;");
       jm.addEndIf();
       DirectAccessible loopVar = jm.addForArray(values);
View Full Code Here

  * @param pName Name of the inner class
  * @param pItems The enumeration items; a public, static, final instance
  *   will be generated for any element in the array
  */
  public JavaInnerClass generate(JavaSource pSource, String pName, Item[] pItems) {
   JavaInnerClass result = pSource.newJavaInnerClass(pName, JavaSource.PUBLIC);
   result.setStatic(true);
   doGenerate(result, pItems);
   return result;
  }
View Full Code Here

      return;
    }
    CustomTableData customTableData = (CustomTableData) pController.getProperty(jdbcSG.getKey());
    if (customTableData != null) {
      JavaQName qName = pController.getComplexTypeSG().getClassContext().getPMName();
      JavaInnerClass jic = pSource.newJavaInnerClass(qName.getClassName());
      getPMClass(pController, jic, customTableData);
    }
  }
View Full Code Here

      return;
    }
    CustomTableData customTableData = (CustomTableData) pController.getProperty(jdbcSG.getKey());
    if (customTableData != null) {
      JavaQName qName = pController.getComplexTypeSG().getClassContext().getPMName();
      JavaInnerClass jic = pSource.newJavaInnerClass(qName.getClassName());
      getPMClass(pController, jic, customTableData);
    }
  }
View Full Code Here

  * @param pName Name of the inner class
  * @param pItems The enumeration items; a public, static, final instance
  *   will be generated for any element in the array
  */
  public JavaInnerClass generate(JavaSource pSource, String pName, Item[] pItems) {
   JavaInnerClass result = pSource.newJavaInnerClass(pName, JavaSource.PUBLIC);
   result.setStatic(true);
   doGenerate(result, pItems);
   return result;
  }
View Full Code Here

    return (GroupHandlerSG) groups.get(pGroup);
  }

  private GroupHandlerSG newGroupHandlerSG(GroupSG pGroup, String pName) throws SAXException {
    JavaSource js = getJavaSource();
    JavaInnerClass jic = js.newJavaInnerClass(pName, JavaSource.PUBLIC);
    jic.addExtends(JMSAXGroupParser.class);
    if (pGroup.isSequence()) {
      return new SequenceHandlerSG(outerHandler, ctSG, pGroup, jic);
    } else if (pGroup.isChoice()) {
      return new ChoiceHandlerSG(outerHandler, ctSG, pGroup, jic);
    } else if (pGroup.isAll()) {
View Full Code Here

    return (GroupHandlerSG) groups.get(pGroup);
  }

  private GroupHandlerSG newGroupHandlerSG(GroupSG pGroup, String pName) throws SAXException {
    JavaSource js = getJavaSource();
    JavaInnerClass jic = js.newJavaInnerClass(pName, JavaSource.PUBLIC);
    jic.addExtends(JMSAXGroupParser.class);
    if (pGroup.isSequence()) {
      return new SequenceHandlerSG(ctSG, pGroup, jic);
    } else if (pGroup.isChoice()) {
      return new ChoiceHandlerSG(ctSG, pGroup, jic);
    } else if (pGroup.isAll()) {
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.js.JavaInnerClass

Copyright © 2018 www.massapicom. 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.