Class MethodHelper

java.lang.Object
com.github.jknack.handlebars.helper.MethodHelper
All Implemented Interfaces:
Helper<Object>

public class MethodHelper extends Object implements Helper<Object>
Wrap a method as Handlebars helper.
See Also:
  • Constructor Details

    • MethodHelper

      public MethodHelper(Method method, Object source)
      Creates a new MethodHelper.
      Parameters:
      method - The method to invoke. Required.
      source - The source or instance object. Might be null.
  • Method Details

    • apply

      public Object apply(Object context, Options options) throws IOException
      Description copied from interface: Helper
      Apply the helper to the context.
      Specified by:
      apply in interface Helper<Object>
      Parameters:
      context - The context object.
      options - The options object.
      Returns:
      A string result.
      Throws:
      IOException - If a template cannot be loaded.