Java Code Examples for com.github.jknack.handlebars.Context#Builder

The following examples show how to use com.github.jknack.handlebars.Context#Builder . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HandlebarsContextFactory.java    From commercetools-sunrise-java with Apache License 2.0 4 votes vote down vote up
public Context create(final Handlebars handlebars, final String templateName, final TemplateContext templateContext) {
    final Context.Builder contextBuilder = createContextBuilder(templateContext);
    return createContext(contextBuilder, templateContext);
}
 
Example 2
Source File: HandlebarsContextFactory.java    From commercetools-sunrise-java with Apache License 2.0 4 votes vote down vote up
protected final Context.Builder createContextBuilder(final TemplateContext templateContext) {
    final Context.Builder contextBuilder = Context.newBuilder(templateContext.pageData());
    return contextBuilderWithValueResolvers(contextBuilder, templateContext);
}
 
Example 3
Source File: HandlebarsContextFactory.java    From commercetools-sunrise-java with Apache License 2.0 4 votes vote down vote up
protected final Context createContext(final Context.Builder contextBuilder, final TemplateContext templateContext) {
    final Context contextWithLocale = contextWithLocale(contextBuilder.build(), templateContext);
    return contextWithCmsPage(contextWithLocale, templateContext);
}
 
Example 4
Source File: HandlebarsContextFactory.java    From commercetools-sunrise-java with Apache License 2.0 4 votes vote down vote up
protected final Context.Builder contextBuilderWithValueResolvers(final Context.Builder contextBuilder, final TemplateContext templateContext) {
    final List<ValueResolver> valueResolvers = valueResolversInContext(templateContext);
    return contextBuilder.resolver(valueResolvers.toArray(new ValueResolver[valueResolvers.size()]));
}