T - The root object type.public interface TypeSafeTemplate<T>
TypeSafeTemplate and add new
methods.
Usage:
public interface UserTemplate extends TypeSafeTemplate{ UserTemplate setAge(int age); UserTemplate setRole(String role); ... } UserTemplate template = new Handlebars().compileInline("{{name}} is {{age}} years old!") .as(UserTemplate.class); template.setAge(32); assertEquals("Edgar is 32 years old!", template.apply(new User("Edgar")));
Template.as(Class),
Template.as()void apply(T context, Writer writer) throws IOException
context - The context object. May be null.writer - The writer object. Required.IOException - If a resource cannot be loaded.String apply(T context) throws IOException
context - The context object. May be null.IOException - If a resource cannot be loaded.Copyright © 2014. All rights reserved.