@Test public void testIterationJSON1() { template = new BoonTemplate(new BoonModernTemplateParser()); Object context = niceJson("{'items' : ['apple', 'oranges', 'pears']}"); replace = template.replace(listTemplate, context); String test = "\n" + " this apple, index 0, key @key, first true, last false\n" + " this oranges, index 1, key @key, first false, last false\n" + " this pears, index 2, key @key, first false, last true\n"; equalsOrDie(test, replace); }
@Override public String replace(String template, Object... context) { initContext(context); this.template = template; parser.parse(template); _buf.readForRecycle(); Iterator<Token> tokens = parser.getTokenList().iterator(); while (tokens.hasNext()) { final Token token = tokens.next(); processToken(tokens, token); } return _buf.toString(); }
BoonTemplate implements Template { @Override public String replace(String template, Object... context) { initContext(context); this.template = template; parser.parse(template); _buf.readForRecycle(); Iterator<Token> tokens = parser.getTokenList().iterator(); while (tokens.hasNext()) { final Token token = tokens.next(); processToken(tokens, token); } return _buf.toString(); } }
BoonTemplate implements Template { @Override public String replace(String template, Object... context) { initContext(context); this.template = template; parser.parse(template); _buf.readForRecycle(); Iterator<Token> tokens = parser.getTokenList().iterator(); while (tokens.hasNext()) { final Token token = tokens.next(); processToken(tokens, token); } return _buf.toString(); } BoonTemplate();  BoonTemplate(TemplateParser templateParser);  BoonTemplate(ExpressionContext context, TemplateParser templateParser); }
BoonTemplate implements Template { @Override public String replace(String template, Object... context) { initContext(context); this.template = template; parser.parse(template); _buf.readForRecycle(); Iterator<Token> tokens = parser.getTokenList().iterator(); while (tokens.hasNext()) { final Token token = tokens.next(); processToken(tokens, token); } return _buf.toString(); } BoonTemplate();  BoonTemplate(TemplateParser templateParser);  BoonTemplate(ExpressionContext context, TemplateParser templateParser); @Override String replace(String template, Object... context); @Override String replaceFromResource(String resource, Object... context); @Override String replaceFromFile(String resource, Object... context); @Override String replaceFromURI(String resource, Object... context); String inlcudeFromURI(String resource); void displayTokens(); static Template template(); static Template jstl(); void addFunctions(Class<?> functions); void addFunctions(String prefix, Class<?> functions); }
BoonTemplate implements Template { @Override public String replace(String template, Object... context) { initContext(context); this.template = template; parser.parse(template); _buf.readForRecycle(); Iterator<Token> tokens = parser.getTokenList().iterator(); while (tokens.hasNext()) { final Token token = tokens.next(); processToken(tokens, token); } return _buf.toString(); } BoonTemplate();  BoonTemplate(TemplateParser templateParser);  BoonTemplate(ExpressionContext context, TemplateParser templateParser); @Override String replace(String template, Object... context); @Override String replaceFromResource(String resource, Object... context); @Override String replaceFromFile(String resource, Object... context); @Override String replaceFromURI(String resource, Object... context); String inlcudeFromURI(String resource); void displayTokens(); static Template template(); static Template jstl(); void addFunctions(Class<?> functions); void addFunctions(String prefix, Class<?> functions);  }