Package cn.bran.japid.classmeta

Examples of cn.bran.japid.classmeta.InnerClassMeta



public class InnerClassMetaTest {
  @Test
  public void testPrintout() {
    InnerClassMeta icm = new InnerClassMeta(
        "my.Display",
        2,
        "String title, String hi",
        "p (\"The real title is: \"); pln(title);"
        );
    System.out.println(icm.toString());
  }
View Full Code Here


    System.out.println(icm.toString());
  }
  @Test
  public void testInvalidCallback() {
    try {
      InnerClassMeta icm = new InnerClassMeta(
          "my.Display",
          2,
          "hi",
          "p (\"The real title is: \"); pln(title);"
          );
View Full Code Here

  /**
   * @param tag
   */
  protected void endRegularTag(Tag tag) {
    if (tag.hasBody) {
      InnerClassMeta bodyInner = this.getTemplateClassMetaData().addCallTagBodyInnerClass(tag.tagName, tag.tagIndex,
          tag.callbackArgs,
          tag.getBodyText());

      if (bodyInner == null)
        throw new RuntimeException("compiler bug? " + tag.tagName + " not allowed to have instance of this tag");
      String tagVar = tag.getTagVarName();
      String tagClassName = tag.tagName;
      if (tagClassName.equals("this")) {
        // call itself
        tagClassName = this.getTemplateClassMetaData().getClassName();
      }

//      String tagline = "final " + tagClassName + " " + tagVar + " = new " + tagClassName + "(getOut()); "
//          + tagVar;
      String tagline = "new " + tagClassName + "(" + getTemplateClassMetaData().getClassName() + ".this)";

      // make sure the tag always use the current output buffer;
//      if (useWithPlay && !tag.tagName.equals(Each.class.getSimpleName())) {
//        tagline += ".setActionRunners(getActionRunners())";
//      }
//      tagline += ".setOut(getOut()); " + tagVar;
      if (tag.argsNamed()) {
        tagline += ".render( " + makeLineMarker(tag.startLine) + "\n"
            + bodyInner.getAnonymous(makeLineMarker(tag.startLine)) + ", "
            + (WebUtils.asBoolean(tag.args) ? tag.args : "") + ");";
      } else {
        tagline += ".render(" + makeLineMarker(tag.startLine) + "\n"
            + (WebUtils.asBoolean(tag.args) ? tag.args + ", " : "")
            + bodyInner.getAnonymous(makeLineMarker(tag.startLine)) + ");";
      }

      // tagline += makeLineMarker(tag.startLine);
      print(tagline);
    } else {
View Full Code Here


public class InnerClassMetaTest {
  @Test
  public void testPrintout() {
    InnerClassMeta icm = new InnerClassMeta(
        "my.Display",
        2,
        "String title, String hi",
        "p (\"The real title is: \"); pln(title);"
        );
    System.out.println(icm.toString());
  }
View Full Code Here

  /**
   * @param tag
   */
  protected void endRegularTag(Tag tag) {
    if (tag.hasBody) {
      InnerClassMeta inner = this.getTemplateClassMetaData().addCallTagBodyInnerClass(tag.tagName, tag.tagIndex, tag.callbackArgs,
          tag.getBodyText());
      if (inner == null)
        System.out.println(tag.tagName + " not allowed to have instance of this tag");
      String tagVar = "_" + tag.getTagVarName() + tag.tagIndex;
      String tagLine = tagVar + ".setOut(getOut()); "; // make sure to use the current string builder
      tagLine += tagVar + ".render(" + (WebUtils.asBoolean(tag.args) ? tag.args + ", " : "") + inner.getAnonymous() + ");";
      println(tagLine);
    } else {
      // for simple tag call without call back:
      this.getTemplateClassMetaData().addCallTagBodyInnerClass(tag.tagName, tag.tagIndex, null, null);
    }
View Full Code Here

  /**
   * @param tag
   */
  protected void endRegularTag(Tag tag) {
    if (tag.hasBody) {
      InnerClassMeta bodyInner = this.getTemplateClassMetaData().addCallTagBodyInnerClass(tag.tagName, tag.tagIndex,
          tag.callbackArgs,
          tag.getBodyText());

      if (bodyInner == null)
        throw new RuntimeException("compiler bug? " + tag.tagName + " not allowed to have instance of this tag");
      String tagVar = tag.getTagVarName();
      String tagClassName = tag.tagName;
      if (tagClassName.equals("this")) {
        // call itself
        tagClassName = this.getTemplateClassMetaData().getClassName();
      }
     
//      String tagline = "final " + tagClassName + " " + tagVar + " = new " + tagClassName + "(getOut()); "
//          + tagVar;
      String tagline = "new " + tagClassName + "(" + getTemplateClassMetaData().getClassName() + ".this)";
           
      // make sure the tag always use the current output buffer;
//      if (useWithPlay && !tag.tagName.equals(Each.class.getSimpleName())) {
//        tagline += ".setActionRunners(getActionRunners())";
//      }
//      tagline += ".setOut(getOut()); " + tagVar;
      if (tag.argsNamed()) {
        tagline += ".render( " + makeLineMarker(tag.startLine) + "\n"
            + bodyInner.getAnonymous(makeLineMarker(tag.startLine)) + ", "
            + (WebUtils.asBoolean(tag.args) ? tag.args : "") + ");";
      } else {
        tagline += ".render(" + makeLineMarker(tag.startLine) + "\n"
            + (WebUtils.asBoolean(tag.args) ? tag.args + ", " : "")
            + bodyInner.getAnonymous(makeLineMarker(tag.startLine)) + ");";
      }
     
//      tagline += makeLineMarker(tag.startLine);
      print(tagline);
    } else {
View Full Code Here

TOP

Related Classes of cn.bran.japid.classmeta.InnerClassMeta

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.