Class JavaFunctionCompiler

java.lang.Object
dev.frostlake.executor.udf.JavaFunctionCompiler

public class JavaFunctionCompiler extends Object
Compiles and executes inline Java user-defined functions
  • Constructor Details

    • JavaFunctionCompiler

      public JavaFunctionCompiler()
  • Method Details

    • compile

      public Class<?> compile(String sourceCode, String className)
      Compiles Java source code and caches the resulting class
      Parameters:
      sourceCode - the Java source code
      className - the fully qualified class name to compile
      Returns:
      the compiled Class object
    • invokeMethod

      public Object invokeMethod(Class<?> clazz, String methodName, Object... args)
      Invokes a static method on a compiled class
      Parameters:
      clazz - the compiled class
      methodName - the name of the static method to invoke
      args - the arguments to pass to the method
      Returns:
      the result of the method invocation