Class PythonFunctionInvoker

java.lang.Object
io.higson.runtime.invoker.PythonFunctionInvoker
All Implemented Interfaces:
FunctionInvoker

public class PythonFunctionInvoker extends Object implements FunctionInvoker
  • Method Details

    • defaultInvoker

      public static PythonFunctionInvoker defaultInvoker(FunctionLoggerCreator functionLoggerCreator)
      Parameters:
      functionLoggerCreator - functionLoggerCreator
      Returns:
      default invoker with basic python language support, without any external modules
    • invokerWithExtraModules

      public static PythonFunctionInvoker invokerWithExtraModules(List<String> module, FunctionLoggerCreator functionLoggerCreator)
      Create python function invoker with support of external packages or modules. Example: padas or numpy
      Parameters:
      module - list of modules to add, if null provided, then nothing bad happens
      Returns:
      ready to ues function invoker
    • invoke

      public Object invoke(Function function, Object... args)
      Description copied from interface: FunctionInvoker
      Invoke function, it is a good practice to wrap any outgoing exceptions with SmartParamException with FUNCTION_INVOKE_ERROR reason.
      Specified by:
      invoke in interface FunctionInvoker
      Parameters:
      function - description of function to invoke
      args - arguments
      Returns:
      evaluated value (can be null)
    • call

      public Object call(PythonFunction function, Object[] args) throws jep.JepException
      Throws:
      jep.JepException
    • invalidate

      public void invalidate(int implId)
    • addGlobalObject

      public void addGlobalObject(FunctionCode code, Object obj)