Package org.stringtemplate.v4

Examples of org.stringtemplate.v4.ST.render()


  }

  public String getImplicitRuleLabel(String ruleName) {
    ST st = getTemplates().getInstanceOf("ImplicitRuleLabel");
    st.add("ruleName", ruleName);
    return st.render();
  }

  public String getElementListName(String name) {
    ST st = getTemplates().getInstanceOf("ElementListName");
    st.add("elemName", getElementName(name));
View Full Code Here


  }

  public String getElementListName(String name) {
    ST st = getTemplates().getInstanceOf("ElementListName");
    st.add("elemName", getElementName(name));
    return st.render();
  }

  public String getElementName(String name) {
    if (".".equals(name)) {
      return "_wild";
View Full Code Here

    ST st = group.getInstanceOf("t");
    st.add("x", 1);
    st.add("y", 2);

    for (int i = 0; i < reps; i++) {
      st.render();
    }
  }

  public void timeLotsOfArgs(int reps) {
    String templates =
View Full Code Here

    ST st = group.getInstanceOf("t");
    st.add("x", 1);
    st.add("y", 2);

    for (int i = 0; i < reps; i++) {
      st.render();
    }
  }

  public void timeSimplePropsOfArgs(int reps) {
    String templates =
View Full Code Here

    STGroup group = new STGroupFile(tmpdir+"/"+"t.stg");
    ST st = group.getInstanceOf("t");
    st.add("x", new User(32,"parrt"));

    for (int i = 0; i < reps; i++) {
      st.render();
    }
  }

  public void timeDynamicAttributeLookup(int reps) {
    String templates =
View Full Code Here

    ST st = group.getInstanceOf("t");
    st.add("x", 1);
    st.add("y", 2);

    for (int i = 0; i < reps; i++) {
      st.render();
    }
  }

  public void timeDeepDynamicLookup(int reps) {
    String templates =
View Full Code Here

    ST st = group.getInstanceOf("t");
    st.add("x", 1);
    st.add("y", 2);

    for (int i = 0; i < reps; i++) {
      st.render();
    }
  }

}
View Full Code Here

  public void timeSingle(int reps) {
    String template =
      "A smallish string to write out";
    ST st = new ST(template);
    for (int i = 0; i < reps; i++) {
      st.render();
    }
  }

  public void timeSingleBigger(int reps) {
    ST st = new ST(bigTemplate);
View Full Code Here

  }

  public void timeSingleBigger(int reps) {
    ST st = new ST(bigTemplate);
    for (int i = 0; i < reps; i++) {
      st.render();
    }
  }
}
View Full Code Here

      group.defineTemplate("test", "x", test.template);
      ST st = group.getInstanceOf("test");
      if ( test.x!=UNDEF ) {
        st.add("x", test.x);
      }
      String result = st.render();
      if ( !result.equals(test.expecting) ) {
        test.result = result;
        failed.add(test);
      }
    }
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.