private void generateDoneMethod(SourceWriter sw, JClassType nonLazyType,
      TreeLogger treeLogger) {
    sw.indent();
    sw.println("public Function done() {");
    sw.indent();
    sw.println("return new Function() {");
    sw.indent();

    sw.println("public void f() {");
    sw.indent();
    String classID = nonLazyType.getSimpleSourceName();
    if ("GQuery".equals(classID)) {
      classID = "GQUERY";
    }

    sw.println(
        "ctx = GQuery.$((Element) getElement()).as(" + nonLazyType.getQualifiedSourceName() + "."
            + classID + ");");
    sw.println("for (int i = 0; i < closures.length(); i++) {");
    sw.indent();
    sw.println("closures.get(i).invoke();");
    sw.outdent();
    sw.println("}");
    sw.outdent();
    sw.println("}");
    sw.outdent();
    sw.println("};");
    sw.outdent();
    sw.println("}");
  }
private void generateDoneMethod ( SourceWriter sw , JClassType nonLazyType , TreeLogger treeLogger ) { sw . indent ( ) ; sw . println ( "public Function done() {" ) ; sw . indent ( ) ; sw . println ( "return new Function() {" ) ; sw . indent ( ) ; sw . println ( "public void f() {" ) ; sw . indent ( ) ; String classID = nonLazyType . getSimpleSourceName ( ) ; if ( "GQuery" . equals ( classID ) ) { classID = "GQUERY" ; } sw . println ( "ctx = GQuery.$((Element) getElement()).as(" + nonLazyType . getQualifiedSourceName ( ) + "." + classID + ");" ) ; sw . println ( "for (int i = 0; i < closures.length(); i++) {" ) ; sw . indent ( ) ; sw . println ( "closures.get(i).invoke();" ) ; sw . outdent ( ) ; sw . println ( "}" ) ; sw . outdent ( ) ; sw . println ( "}" ) ; sw . outdent ( ) ; sw . println ( "};" ) ; sw . outdent ( ) ; sw . println ( "}" ) ; }
used by benchmark harness