@Test public void t0() { Map<String, Object> attrs = new HashMap<>(4); attrs.put("a", 1); Conf conf = new Conf(); conf.setConfigOverridePath("/aaa"); attrs.put("c", conf); attrs.put("b", Arrays.asList(1, 2, 3)); String template = "<i>${a + 1}</i><i>${1+3}</i><i>${c.configOverridePath}</i>"; String result = engine.render(template, attrs); Assert.assertEquals("<i>2</i><i>4</i><i>/aaa</i>", result); template = "<a>${x,$</a>"; result = engine.render(template, attrs); Assert.assertEquals(template, result); template = "<a>\\${x,${a}</a>"; result = engine.render(template, attrs); Assert.assertEquals("<a>${x,1</a>", result); }
@Override public String render(String template, Map<String, Object> attrs) { StringWriter writer = new StringWriter(); render(template, attrs, writer); return writer.toString(); }
SimpleTemplateEngine implements TemplateEngine { @Override public String render(String template, Map<String, Object> attrs) { StringWriter writer = new StringWriter(); render(template, attrs, writer); return writer.toString(); } }
SimpleTemplateEngine implements TemplateEngine { @Override public String render(String template, Map<String, Object> attrs) { StringWriter writer = new StringWriter(); render(template, attrs, writer); return writer.toString(); }  }
SimpleTemplateEngine implements TemplateEngine { @Override public String render(String template, Map<String, Object> attrs) { StringWriter writer = new StringWriter(); render(template, attrs, writer); return writer.toString(); }  @Override String render(String template, Map<String, Object> attrs); @Override void render(String template, Map<String, Object> attrs, Writer writer); }
SimpleTemplateEngine implements TemplateEngine { @Override public String render(String template, Map<String, Object> attrs) { StringWriter writer = new StringWriter(); render(template, attrs, writer); return writer.toString(); }  @Override String render(String template, Map<String, Object> attrs); @Override void render(String template, Map<String, Object> attrs, Writer writer);  }