Package com.morpheusdata.views
Interface Renderer<T>
- Type Parameters:
T
- Engine Type
- All Known Implementing Classes:
HandlebarsRenderer
public interface Renderer<T>
Renderer is an interface that can render templates and lookup templates from multiple class loaders.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addTemplateLoader
(ClassLoader loader) Provide a class path for this renderer to lookup templates.The implementation of the actual engine to be used in this rendererIterable<com.github.jknack.handlebars.io.TemplateLoader>
List of all template loaders available for this Renderervoid
removeTemplateLoader
(ClassLoader loader) Remove a template loader based on classpathGiven a template and a model, returns a TemplateResponserenderTemplate
(String location, ViewModel<?> model) Given a template location and a model, returns a TemplateResponse
-
Method Details
-
render
Given a template and a model, returns a TemplateResponse- Parameters:
template
- String representation of a template the engine can use.model
- ViewModel to be passed in with the template- Returns:
- TemplateResponse
-
renderTemplate
Given a template location and a model, returns a TemplateResponse- Parameters:
location
- Location where the engine can find the template.model
- ViewModel to be passed in with the template- Returns:
- TemplateResponse
-
getTemplateLoaders
Iterable<com.github.jknack.handlebars.io.TemplateLoader> getTemplateLoaders()List of all template loaders available for this Renderer- Returns:
- List of TemplateLoaders
-
addTemplateLoader
Provide a class path for this renderer to lookup templates.- Parameters:
loader
- classloader for use in template lookup
-
removeTemplateLoader
Remove a template loader based on classpath- Parameters:
loader
- classloader to remove from template lookup.
-
getEngine
T getEngine()The implementation of the actual engine to be used in this renderer- Returns:
- engine
-