@Test public void cForSortEmployees2() { employees = Lists.list( new Employee("Rick", "Hightower", 1, new Phone("320", "555", "1212"), Fruit.ORANGES, Fruit.APPLES, Fruit.STRAWBERRIES), new Employee("Adam", "Hightower", 1, new Phone("320", "555", "1212"), Fruit.ORANGES, Fruit.APPLES, Fruit.STRAWBERRIES), new Employee("Zed", "Hightower", 1, new Phone("320", "555", "1212"), Fruit.ORANGES, Fruit.APPLES, Fruit.STRAWBERRIES), new Employee("Lucas", "Hightower", 1, new Phone("320", "555", "1212"), Fruit.ORANGES, Fruit.APPLES, Fruit.STRAWBERRIES), new Employee("Ryan", "Hightower", 1, new Phone("320", "555", "1212"), Fruit.ORANGES, Fruit.APPLES, Fruit.STRAWBERRIES), new Employee("Lucas", "Smith", 1, new Phone("320", "555", "1212"), Fruit.ORANGES, Fruit.APPLES, Fruit.STRAWBERRIES) ); String results = template.replace( "\n<c:for items='${fn:sortBy(employees, firstName, lastName)}'> ${this.firstName}, ${this.lastName}\n</c:for>", Maps.map("employees", employees)); Boon.equalsOrDie("#\n" + " Adam, Hightower\n" + " Lucas, Hightower\n" + " Lucas, Smith\n" + " Rick, Hightower\n" + " Ryan, Hightower\n" + " Zed, Hightower\n" + "#", "#" + results + "#"); results = template.replace( "\n<c:for items='${fn:sortBy(employees, firstName_desc, lastName)}'> ${this.firstName}, ${this.lastName}\n</c:for>", Maps.map("employees", employees)); Boon.equalsOrDie("#\n" + " Zed, Hightower\n" + " Ryan, Hightower\n" + " Rick, Hightower\n" + " Lucas, Hightower\n" + " Lucas, Smith\n" + " Adam, Hightower\n" + "#", "#" + results + "#"); results = template.replace( "\n<c:for items='${fn:sortBy(employees, firstName_desc, lastName_desc)}'> ${this.firstName}, ${this.lastName}\n</c:for>", Maps.map("employees", employees)); Boon.equalsOrDie("#\n" + " Zed, Hightower\n" + " Ryan, Hightower\n" + " Rick, Hightower\n" + " Lucas, Smith\n" + " Lucas, Hightower\n" + " Adam, Hightower\n" + "#", "#" + results + "#"); }
@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);  }