Interface Lambda<C,O>

Type Parameters:
C - The lambda context.
O - The lambda output.

@Deprecated(since="2024-07-10") public interface Lambda<C,O>
Deprecated.
com.github.jknack.handlebars package is deprecated and marked for removal in subsequent releases which will involve removal of the handlebars dependency in AEM.

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<String>() {
    public String apply(Scope scope, Template template) {
     return "" + template.apply(scope) + "";
    }
  });
  

Output:

  Willy is awesome.
  
  • Method Summary

    Modifier and Type
    Method
    Description
    apply(C context, Template template)
    Deprecated.
    Apply the lambda.
  • Method Details

    • apply

      O apply(C context, Template template) throws IOException
      Deprecated.
      Apply the lambda.
      Parameters:
      context - The current context.
      template - The current template.
      Returns:
      The resulting text.
      Throws:
      IOException - If the resource cannot be loaded.