类 GroovyScriptRuntime

java.lang.Object
com.codingapi.springboot.script.GroovyScriptRuntime

public class GroovyScriptRuntime extends Object
groovy script 执行上下文对象
  • 构造器详细资料

    • GroovyScriptRuntime

      public GroovyScriptRuntime(int maxCacheSize)
  • 方法详细资料

    • clearCache

      public void clearCache()
      清空缓存对象
    • cacheSize

      public int cacheSize()
      缓存大小
    • compile

      public void compile(String script, boolean cache)
      编译脚本
      参数:
      script - 脚本内容
      cache - 是否缓存
    • compile

      public void compile(String script)
      编译脚本,非缓存模式
      参数:
      script - 脚本内容
    • invoke

      public <T> T invoke(String method, String script, Class<T> returnType, Map<String,Object> binds, Object... args)
      执行函数脚本
      参数:
      method - 函数名称
      script - 脚本内容
      returnType - 返回类型
      binds - 绑定数据对象
      args - 函数参数
      返回:
      返回数据
    • invoke

      public <T> T invoke(String method, String script, Class<T> returnType, Object... args)
      执行函数脚本
      参数:
      method - 函数名称
      script - 脚本内容
      returnType - 返回类型
      args - 函数参数
      返回:
      返回数据
    • invoke

      public <T> T invoke(String method, String script, Class<T> returnType, TransactionMode transactionMode, Map<String,Object> binds, Object... args)
      执行函数脚本
      参数:
      method - 函数名称
      script - 脚本内容
      returnType - 返回类型
      transactionMode - 事务模式
      binds - 绑定数据对象
      args - 函数参数
      返回:
      返回数据
    • run

      public <T> T run(String script, Class<T> returnType, Map<String,Object> binds)
      执行脚本
      参数:
      script - 脚本
      returnType - 返回数据类型
      binds - 绑定对象
      返回:
      返回数据
    • run

      public <T> T run(String script, Class<T> returnType, TransactionMode transactionMode, Map<String,Object> binds)
      执行脚本
      参数:
      script - 脚本
      returnType - 返回数据类型
      transactionMode - 事务模式
      binds - 绑定对象
      返回:
      返回数据