|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
C - The lambda context.O - The lambda output.public interface Lambda<C,O>
When the value is a callable object, such as a lambda, the object will be invoked and passed the block of text. The text passed is the literal block, unrendered. {{tags}} will not have been expanded - the lambda should do that on its own. In this way you can implement filters or caching.
Template:
{{#wrapped}}
{{name}} is awesome.
{{/wrapped}}
Hash:
Map hash = ...
hash.put("name", "Willy");
hash.put("wrapped", new Lambda() {
public String apply(Scope scope, Template template) {
return "" + template.apply(scope) + "";
}
});
Output:
Willy is awesome.
| Method Summary | |
|---|---|
O |
apply(C context,
Template template)
Apply the lambda. |
| Method Detail |
|---|
O apply(C context,
Template template)
throws IOException
context - The current context.template - The current template.
IOException - If the resource cannot be loaded.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||