Examples of JavaInnerClass


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

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

    /** 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

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

  }
 
  /** <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

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

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

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

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

  * @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

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

    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

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

  private GroupDriverSG newGroupDriverSG(GroupSG pGroup, String pName) throws SAXException {
    //JavaSource js = getOuterGroup();
    //JavaInnerClass jic = js.newJavaInnerClass(pName, JavaSource.PUBLIC);
    //jic.addExtends(JMSAXGroupParser.class);
    JavaInnerClass jic = null;
    if (pGroup.isSequence()) {
      return new SequenceDriverSG(ctSG, pGroup, getOuterGroup(), jic);
    } else if (pGroup.isChoice()) {
      return new ChoiceDriverSG(ctSG, pGroup, getOuterGroup(), jic);
    } else if (pGroup.isAll()) {
View Full Code Here

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

  * @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

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

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

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

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

  private boolean isValidInnerClassName(JavaSource pSource, String pName) {
    boolean isInnerClass = pSource.isInnerClass();
    final String name;
    if (isInnerClass) {
      JavaInnerClass jic = (JavaInnerClass) pSource;
      if (!isValidInnerClassName(jic.getOuterClass(), pName)) {
        return false;
      }
      name = jic.getQName().getInnerClassName();
    } else {
      name = pSource.getQName().getClassName();
    }
    if (name.equals(pName)) {
      return false;
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.