@Test public void testFormatByMapParams() { String tpl = "${k1}-${k2}"; Map<String, Object> args = new HashMap<String, Object>(); args.put("k1", "v1"); args.put("k2", 2); Assert.assertEquals("v1-2", TemplateUtils.format(tpl, args)); }
public static String format(String tpl, Object[] args) { if (tpl == null || tpl.length() == 0) return ""; if (null == args || args.length == 0) return tpl; return MessageFormat.format(tpl, args); }
TemplateUtils { public static String format(String tpl, Object[] args) { if (tpl == null || tpl.length() == 0) return ""; if (null == args || args.length == 0) return tpl; return MessageFormat.format(tpl, args); } }
TemplateUtils { public static String format(String tpl, Object[] args) { if (tpl == null || tpl.length() == 0) return ""; if (null == args || args.length == 0) return tpl; return MessageFormat.format(tpl, args); } private  TemplateUtils(); }
TemplateUtils { public static String format(String tpl, Object[] args) { if (tpl == null || tpl.length() == 0) return ""; if (null == args || args.length == 0) return tpl; return MessageFormat.format(tpl, args); } private  TemplateUtils(); void setRootPath(String rootPath); static String format(String tpl, Object[] args); static String format(String tpl, Map<String, Object> args); static List<String> findMarkers(InputStream is); static String loadText(InputStream is); static String loadText(InputStream is, String charsetName); static List<String> findMarkers(String source); static void copy(String source, OutputStream out); static String getContent(String code); }
TemplateUtils { public static String format(String tpl, Object[] args) { if (tpl == null || tpl.length() == 0) return ""; if (null == args || args.length == 0) return tpl; return MessageFormat.format(tpl, args); } private  TemplateUtils(); void setRootPath(String rootPath); static String format(String tpl, Object[] args); static String format(String tpl, Map<String, Object> args); static List<String> findMarkers(InputStream is); static String loadText(InputStream is); static String loadText(InputStream is, String charsetName); static List<String> findMarkers(String source); static void copy(String source, OutputStream out); static String getContent(String code); static String ROOT_PATH; }