@Test public void test_render() throws Exception { String templateVariable = "Hello Jinjava!"; Map<String, Object> model = new HashMap<>(); model.put("message", templateVariable); String expected = String.format("<h1>%s</h1>", templateVariable); String actual = new JinjavaEngine().render(new ModelAndView(model, "template/hello.jin")); assertEquals(expected, actual); }
@Override public String render(ModelAndView modelAndView) { Object model = modelAndView.getModel(); if (model instanceof Map) { String template = null; try { template = Resources.toString(Resources.getResource(modelAndView.getViewName()), Charsets.UTF_8); } catch (IOException ignored) { } return jinjava.render(template, (Map<String, Object>) model); } else { throw new IllegalArgumentException("modelAndView.getModel() must return a java.util.Map"); } }
JinjavaEngine extends TemplateEngine { @Override public String render(ModelAndView modelAndView) { Object model = modelAndView.getModel(); if (model instanceof Map) { String template = null; try { template = Resources.toString(Resources.getResource(modelAndView.getViewName()), Charsets.UTF_8); } catch (IOException ignored) { } return jinjava.render(template, (Map<String, Object>) model); } else { throw new IllegalArgumentException("modelAndView.getModel() must return a java.util.Map"); } } }
JinjavaEngine extends TemplateEngine { @Override public String render(ModelAndView modelAndView) { Object model = modelAndView.getModel(); if (model instanceof Map) { String template = null; try { template = Resources.toString(Resources.getResource(modelAndView.getViewName()), Charsets.UTF_8); } catch (IOException ignored) { } return jinjava.render(template, (Map<String, Object>) model); } else { throw new IllegalArgumentException("modelAndView.getModel() must return a java.util.Map"); } } JinjavaEngine();  JinjavaEngine(JinjavaConfig jinjavaConfig);  JinjavaEngine(JinjavaConfig jinjavaConfig, ResourceLocator resourceLocator); }
JinjavaEngine extends TemplateEngine { @Override public String render(ModelAndView modelAndView) { Object model = modelAndView.getModel(); if (model instanceof Map) { String template = null; try { template = Resources.toString(Resources.getResource(modelAndView.getViewName()), Charsets.UTF_8); } catch (IOException ignored) { } return jinjava.render(template, (Map<String, Object>) model); } else { throw new IllegalArgumentException("modelAndView.getModel() must return a java.util.Map"); } } JinjavaEngine();  JinjavaEngine(JinjavaConfig jinjavaConfig);  JinjavaEngine(JinjavaConfig jinjavaConfig, ResourceLocator resourceLocator); void registerTag(Tag tag); void registerFilter(Filter filter); void registerFunction(ELFunctionDefinition function); @Override String render(ModelAndView modelAndView); }
JinjavaEngine extends TemplateEngine { @Override public String render(ModelAndView modelAndView) { Object model = modelAndView.getModel(); if (model instanceof Map) { String template = null; try { template = Resources.toString(Resources.getResource(modelAndView.getViewName()), Charsets.UTF_8); } catch (IOException ignored) { } return jinjava.render(template, (Map<String, Object>) model); } else { throw new IllegalArgumentException("modelAndView.getModel() must return a java.util.Map"); } } JinjavaEngine();  JinjavaEngine(JinjavaConfig jinjavaConfig);  JinjavaEngine(JinjavaConfig jinjavaConfig, ResourceLocator resourceLocator); void registerTag(Tag tag); void registerFilter(Filter filter); void registerFunction(ELFunctionDefinition function); @Override String render(ModelAndView modelAndView);  }