Package com.floreysoft.jmte.token

Examples of com.floreysoft.jmte.token.ForEachToken.evaluate()


  protected String transformCompiled(TemplateContext context) {
    StringBuilder buffer = new StringBuilder();

    // ${foreach list item}
    ForEachToken token1 = new ForEachToken("list", "item", "");
    token1.setIterable((Iterable) token1.evaluate(context));
    context.model.enterScope();
    context.push(token1);
    try {
      while (token1.iterator().hasNext()) {
        context.model.put(token1.getVarName(), token1.advance());
View Full Code Here


        // ${foreach item.list item2}
        ForEachToken token2 = new ForEachToken(Arrays
            .asList(new String[] { "item", "list" }), "item.list",
            "item2", "");
        token2.setIterable((Iterable) token2.evaluate(context));
        context.model.enterScope();
        context.push(token2);
        try {
          while (token2.iterator().hasNext()) {
            context.model
View Full Code Here

  protected String transformCompiled(TemplateContext context) {
    StringBuilder buffer = new StringBuilder();

    ForEachToken token1 = new ForEachToken(Arrays
        .asList(new String[] { "list" }), "list", "item", "\n");
    token1.setIterable((Iterable) token1.evaluate(context));

    context.model.enterScope();
    context.push(token1);
    try {
      while (token1.iterator().hasNext()) {
View Full Code Here

  }

  @SuppressWarnings({ "unchecked", "rawtypes" })
  private void foreach(boolean inheritedSkip) {
    ForEachToken feToken = (ForEachToken) tokenStream.currentToken();
    Iterable iterable = (Iterable) feToken.evaluate(context);
    // begin a fresh iteration with a reset index
    feToken.setIterator(iterable.iterator());
    feToken.resetIndex();
    tokenStream.consume();
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.