Class FunctionEvaluator

java.lang.Object
io.github.erdos.stencil.functions.FunctionEvaluator

public final class FunctionEvaluator extends Object
  • Constructor Details

    • FunctionEvaluator

      public FunctionEvaluator()
  • Method Details

    • registerFunctions

      public void registerFunctions(Function... functions)
      Registers a function to this evaluator engine. Registered functions can be invoked from inside template files.
      Parameters:
      functions - list of functions to register
    • call

      public Object call(String functionName, Object... arguments)
      Calls a function by name.
      Parameters:
      functionName - Case Insensitive name of fn to call.
      arguments - arguments dispatched to called function
      Returns:
      result of function call
      Throws:
      IllegalArgumentException - when function name is null or missing
    • listFunctions

      public Iterable<Function> listFunctions()
      Returns a thread-safe sequence of all registered functions.