Class BoundTemplateHandler<T>
java.lang.Object
com.blackbuild.klum.ast.runtime.internal.BoundTemplateHandler<T>
- Type Parameters:
T- the type of the template being handled
A typed wrapper for scoped TemplateManager application without the need to specify the first class parameter.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<C> CExecutes the given closure with an anonymous template.<C> CExecutes the given closure with the given template as the template.<C> CExecutes the given closure with the given templates.<C> CExecutes the given closure with the given anonymous templates.
-
Constructor Details
-
BoundTemplateHandler
-
-
Method Details
-
With
Executes the given closure with the given template as the template. This means that all objects of the owner's type created in the scope of the closure will use the given template, which also includes objects deeper in the structure as well as objects created in a later phase. The old template is restored after the closure has been executed.- Type Parameters:
C- the return type of the closure- Parameters:
template- the templatebody- the closure to execute- Returns:
- the result of the closure
-
With
Executes the given closure with an anonymous template. This means that all objects of the owner's type created in the scope of the closure will use the given template, which also includes objects deeper in the structure as well as objects created in a later phase. The template will be created from the given map (using Create.AsTemplate(Map)). The old template is restored after the closure has been executed.- Type Parameters:
C- the return type of the closure- Parameters:
template- the Map to construct the template frombody- the closure to execute- Returns:
- the result of the closure
-
WithAll
Executes the given closure with the given anonymous templates. This is done by converting the values of the map into template objects of the type defined by the keys.- Type Parameters:
C- the return type of the closure- Parameters:
newTemplates- the templates to apply, Mapping classes to their respective anonymous templatesbody- the closure to execute- Returns:
- the result of the closure
-
WithAll
Executes the given closure with the given templates. This means that all objects of the given types created in the scope of the closure will use the given template, which also includes objects deeper in the structure. The old templates are restored after the closure has been executed.- Parameters:
newTemplates- the templates to applybody- the closure to execute- Returns:
- the result of the closure
-