/** * Sets search filter template. * @param filterTemplate search filter template * @return the current instance of the builder */ public QueryBuilder filter(String filterTemplate) { this.filterTemplate = new ST(filterTemplate); return this; }
@Override public String render(String sql, StatementContext ctx) { ST template = new ST(new STGroup(), sql); ctx.getAttributes().forEach(template::add); return template.render(); } }
public byte[] getTemplateData(String templateResource, Map<String, WidInfo> widInfoMap) throws IOException { ST stTemplate = new ST(getTemplateResourceFileAsString(templateResource), '$', '$'); stTemplate.add("widInfo", widInfoMap); stTemplate.add("openbracket", "{"); stTemplate.add("closebracket", "}"); return stTemplate.render().getBytes(); }
ST createTab_stmt = new ST(createTab_str.toString());
ST createTab_stmt = new ST(createTab_str.toString());
private ST tmplt(String template) { return new ST(template, '$', '$'); }
List<String> teams = Arrays.asList("Cats", "Birds", "Turtles"); ST s = new ST( "<teams :{team | <team> }>"); s.add("teams", teams); System.out.println(s.render());
String simpleTeamTemplate = "<teams:{ team |<team.name> has <length(team.players)> players<\\n>}>"; ST template = new ST( simpleTeamTemplate ); template.add("teams", teams); System.out.println(template.render());
String template = "<list :{ items |<items :{ item |<item> }><\\n>}>"; ST st = new ST( template); st.add("list", listOfLists); System.out.println(st.render());
Player[] players = new Player[] { new Player("Bill", 29), new Player("Steve", 30), new Player("Toby", 15) }; String playerTemplate = "<players:{ player |<player.name> is <player.age> <\\n>}>" ST s = new ST( playerTemplate ); s.add("players", Arrays.asList(players)); System.out.println(s.render());
public ST createStringTemplate(CompiledST impl) { ST st = new ST(); st.impl = impl; st.groupThatCreatedThisInstance = this; if ( impl.formalArguments!=null ) { st.locals = new Object[impl.formalArguments.size()]; Arrays.fill(st.locals, ST.EMPTY_ATTR); } return st; }
public ST createStringTemplate(CompiledST impl) { ST st = new ST(); st.impl = impl; st.groupThatCreatedThisInstance = this; if ( impl.formalArguments!=null ) { st.locals = new Object[impl.formalArguments.size()]; Arrays.fill(st.locals, ST.EMPTY_ATTR); } return st; }
public ST createStringTemplate(CompiledST impl) { ST st = new ST(); st.impl = impl; st.groupThatCreatedThisInstance = this; if ( impl.formalArguments!=null ) { st.locals = new Object[impl.formalArguments.size()]; Arrays.fill(st.locals, ST.EMPTY_ATTR); } return st; }
public ST createStringTemplate(CompiledST impl) { ST st = new ST(); st.impl = impl; st.groupThatCreatedThisInstance = this; if ( impl.formalArguments!=null ) { st.locals = new Object[impl.formalArguments.size()]; Arrays.fill(st.locals, ST.EMPTY_ATTR); } return st; }
@Override public ST genExpr(CodeGenerator generator, STGroup templates, DFA dfa) { if ( templates!=null ) { return templates.getInstanceOf("false"); } return new ST("false"); }
@Override public ST genExpr(CodeGenerator generator, STGroup templates, DFA dfa) { if ( templates!=null ) { return templates.getInstanceOf("false"); } return new ST("false"); }
public static String format(int lineWidth, String template, Object... attributes) { template = template.replaceAll("%([0-9]+)", "arg$1"); System.out.println(template); ST st = new ST(template); int i = 1; for (Object a : attributes) { st.add("arg"+i, a); i++; } return st.render(lineWidth); } }
public static String format(int lineWidth, String template, Object... attributes) { template = template.replaceAll("%([0-9]+)", "arg$1"); ST st = new ST(template); int i = 1; for (Object a : attributes) { st.add("arg"+i, a); i++; } return st.render(lineWidth); } }
public static String format(int lineWidth, String template, Object... attributes) { template = template.replaceAll("%([0-9]+)", "arg$1"); ST st = new ST(template); int i = 1; for (Object a : attributes) { st.add("arg"+i, a); i++; } return st.render(lineWidth); } }
public static String format(int lineWidth, String template, Object... attributes) { template = template.replaceAll("%([0-9]+)", "arg$1"); ST st = new ST(template); int i = 1; for (Object a : attributes) { st.add("arg"+i, a); i++; } return st.render(lineWidth); } }