use of core.framework.impl.template.HTMLTemplateBuilder in project core-ng-project by neowu.
the class HTMLTemplateEngine method add.
private void add(TemplateSource source, Class<?> modelClass) {
StopWatch watch = new StopWatch();
String name = source.name();
try {
HTMLTemplate previous = templates.putIfAbsent(name, new HTMLTemplateBuilder(source, modelClass).build());
if (previous != null)
throw Exceptions.error("template is already added, name={}", name);
} finally {
logger.info("add, name={}, modelClass={}, elapsedTime={}", name, modelClass.getCanonicalName(), watch.elapsedTime());
}
}
use of core.framework.impl.template.HTMLTemplateBuilder in project core-ng-project by neowu.
the class TemplateManager method load.
private Map<String, HTMLTemplate> load(String templatePath, Class<?> modelClass) {
HTMLTemplateBuilder builder = new HTMLTemplateBuilder(new FileTemplateSource(webDirectory.root(), templatePath), modelClass);
builder.cdn = cdnManager;
Map<String, HTMLTemplate> templates = Maps.newHashMap();
for (String language : message.languages) {
builder.message = key -> message.get(key, language);
HTMLTemplate htmlTemplate = builder.build();
templates.put(language, htmlTemplate);
}
return templates;
}
Aggregations