Class FunctionEvaluator


  • public final class FunctionEvaluator
    extends java.lang.Object
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FunctionEvaluator

        public FunctionEvaluator()
    • 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.