Create Thymeleaf 3 models using the Groovy builder syntax.
| Constructor and description |
|---|
ModelBuilder
(ITemplateContext context)Constructor, create a new model builder. |
ModelBuilder
(IModelFactory modelFactory, ElementDefinitions elementDefinitions, TemplateMode templateMode)Constructor, create a new model builder. |
| Type | Name and description |
|---|---|
void |
add(IModel model)Appends an existing model to the model being built. |
IModel |
build(Closure definition)Captures the top `build` call so that it doesn't end up as a node in the final model. |
protected Object |
createNode(Object name)Create a model for the given element. |
protected Object |
createNode(Object name, Object value)Create a model for the given element and inner text content. |
protected Object |
createNode(Object name, Map attributes)Create a model for the given element and attributes. |
protected IModel |
createNode(Object name, Map attributes, Object value)Create a model for the given element, attributes, and inner text content. |
protected void |
nodeCompleted(Object parent, Object child)Link a parent and child node. |
protected void |
setParent(Object parent, Object child)Does nothing. |
| Methods inherited from class | Name |
|---|---|
class BuilderSupport |
invokeMethod, invokeMethod, setProperty, getProperty, getMetaClass, setMetaClass, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
class GroovyObjectSupport |
setProperty, getProperty, invokeMethod, getMetaClass, setMetaClass, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Constructor, create a new model builder.
Constructor, create a new model builder.
Appends an existing model to the model being built.
Captures the top `build` call so that it doesn't end up as a node in the final model.
Create a model for the given element.
name - Element name.Create a model for the given element and inner text content.
name - Element name.value - Text content.Create a model for the given element and attributes.
name - Element name.attributes - Element attributes.Create a model for the given element, attributes, and inner text content.
name - Element name.attributes - Element attributes.value - Text content.Link a parent and child node. A child node is appended to a parent by being the last sub-model before the parent close tag.
Does nothing. Because models only copy events when added to one another, we can't just add child events at this point - we need to wait until that child has had it's children added, and so on. So the parent/child link is made in the ModelBuilder.nodeCompleted method instead.