Class FunctionEvaluator
- java.lang.Object
-
- io.github.erdos.stencil.functions.FunctionEvaluator
-
public final class FunctionEvaluator extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description FunctionEvaluator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
call(java.lang.String functionName, java.lang.Object... arguments)
Calls a function by name.java.lang.Iterable<Function>
listFunctions()
Returns a thread-safe sequence of all registered functions.void
registerFunctions(Function... functions)
Registers a function to this evaluator engine.
-
-
-
Method Detail
-
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 java.lang.Object call(java.lang.String functionName, java.lang.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:
java.lang.IllegalArgumentException
- when function name is null or missing
-
listFunctions
public java.lang.Iterable<Function> listFunctions()
Returns a thread-safe sequence of all registered functions.
-
-