Package com.fizzed.rocker
Class BindableRockerModel
- java.lang.Object
-
- com.fizzed.rocker.BindableRockerModel
-
- All Implemented Interfaces:
RockerModel
public class BindableRockerModel extends java.lang.Object implements RockerModel
Wraps a template model to allow fields to be set dynamically via reflection.
-
-
Field Summary
Fields Modifier and Type Field Description private RockerModelmodelprivate java.lang.StringtemplateClassNameprivate java.lang.StringtemplatePath
-
Constructor Summary
Constructors Constructor Description BindableRockerModel(java.lang.String templatePath, java.lang.String templateClassName, RockerModel model)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BindableRockerModel__body(RockerContent __body)Do not use this method in your controller code.BindableRockerModelbind(java.lang.String name, java.lang.Object value)BindableRockerModelbind(java.util.Map<java.lang.String,java.lang.Object> values)RockerModelgetModel()BindableRockerModelrelaxedBind(java.util.Map<java.lang.String,java.lang.Object> values)RockerOutputrender()Executes a template model and renders content to output.<T extends RockerOutput>
Trender(RockerOutputFactory<T> outputFactory)Executes a template model and renders content to output.<T extends RockerOutput>
Trender(RockerOutputFactory<T> outputFactory, RockerTemplateCustomizer templateCustomizer)Executes a template model and renders content to output.
-
-
-
Field Detail
-
templatePath
private final java.lang.String templatePath
-
templateClassName
private final java.lang.String templateClassName
-
model
private final RockerModel model
-
-
Constructor Detail
-
BindableRockerModel
public BindableRockerModel(java.lang.String templatePath, java.lang.String templateClassName, RockerModel model)
-
-
Method Detail
-
bind
public BindableRockerModel bind(java.util.Map<java.lang.String,java.lang.Object> values)
-
relaxedBind
public BindableRockerModel relaxedBind(java.util.Map<java.lang.String,java.lang.Object> values)
-
bind
public BindableRockerModel bind(java.lang.String name, java.lang.Object value)
-
render
public RockerOutput render() throws RenderingException
Description copied from interface:RockerModelExecutes a template model and renders content to output. Single use only.- Specified by:
renderin interfaceRockerModel- Returns:
- The output of rendering process
- Throws:
RenderingException- Thrown if any error encountered while rendering template. Exception will include underlying cause as well as line and position of original template source that triggered exception.
-
render
public <T extends RockerOutput> T render(RockerOutputFactory<T> outputFactory) throws RenderingException
Description copied from interface:RockerModelExecutes a template model and renders content to output. Single use only.- Specified by:
renderin interfaceRockerModel- Type Parameters:
T- The output type- Parameters:
outputFactory- A factory to create a new RockerOutput. If null then the a default defined by the template will be used instead.- Returns:
- The output of rendering process
- Throws:
RenderingException- Thrown if any error encountered while rendering template. Exception will include underlying cause as well as line and position of original template source that triggered exception.
-
render
public <T extends RockerOutput> T render(RockerOutputFactory<T> outputFactory, RockerTemplateCustomizer templateCustomizer) throws RenderingException
Description copied from interface:RockerModelExecutes a template model and renders content to output. Single use only.- Specified by:
renderin interfaceRockerModel- Type Parameters:
T- The output type- Parameters:
outputFactory- A factory to create a new RockerOutput. If null then the a default defined by the template will be used instead.templateCustomizer- A customizer for last second changes to template between the time its built and the time it actually is rendered. Useful for injecting implicit variables in frameworks. If null then no customization will be done.- Returns:
- The output of rendering process
- Throws:
RenderingException- Thrown if any error encountered while rendering template. Exception will include underlying cause as well as line and position of original template source that triggered exception.
-
getModel
public RockerModel getModel()
-
__body
public BindableRockerModel __body(RockerContent __body)
Do not use this method in your controller code. Intended for internal use.
-
-