Class DefaultSandbox.Builder

java.lang.Object
cloud.opencode.base.expression.sandbox.DefaultSandbox.Builder
Enclosing class:
DefaultSandbox

public static class DefaultSandbox.Builder extends Object
Builder for DefaultSandbox DefaultSandbox构建器
Since:
JDK 25, opencode-base-expression V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • addAllowedClass

      public DefaultSandbox.Builder addAllowedClass(String className)
      Add allowed class 添加允许的类
      Parameters:
      className - the class name | 类名
      Returns:
      this builder | 此构建器
    • addAllowedClass

      public DefaultSandbox.Builder addAllowedClass(Class<?> clazz)
      Add allowed class 添加允许的类
      Parameters:
      clazz - the class | 类
      Returns:
      this builder | 此构建器
    • addDeniedClass

      public DefaultSandbox.Builder addDeniedClass(String className)
      Add denied class 添加拒绝的类
      Parameters:
      className - the class name | 类名
      Returns:
      this builder | 此构建器
    • addDeniedClass

      public DefaultSandbox.Builder addDeniedClass(Class<?> clazz)
      Add denied class 添加拒绝的类
      Parameters:
      clazz - the class | 类
      Returns:
      this builder | 此构建器
    • addAllowedPackage

      public DefaultSandbox.Builder addAllowedPackage(String packageName)
      Add allowed package 添加允许的包
      Parameters:
      packageName - the package name | 包名
      Returns:
      this builder | 此构建器
    • addDeniedPackage

      public DefaultSandbox.Builder addDeniedPackage(String packageName)
      Add denied package 添加拒绝的包
      Parameters:
      packageName - the package name | 包名
      Returns:
      this builder | 此构建器
    • addAllowedMethod

      public DefaultSandbox.Builder addAllowedMethod(String methodName)
      Add allowed method 添加允许的方法
      Parameters:
      methodName - the method name | 方法名
      Returns:
      this builder | 此构建器
    • addDeniedMethod

      public DefaultSandbox.Builder addDeniedMethod(String methodName)
      Add denied method 添加拒绝的方法
      Parameters:
      methodName - the method name | 方法名
      Returns:
      this builder | 此构建器
    • maxExpressionLength

      public DefaultSandbox.Builder maxExpressionLength(int length)
      Set max expression length 设置最大表达式长度
      Parameters:
      length - the max length | 最大长度
      Returns:
      this builder | 此构建器
    • maxEvaluationDepth

      public DefaultSandbox.Builder maxEvaluationDepth(int depth)
      Set max evaluation depth 设置最大求值深度
      Parameters:
      depth - the max depth | 最大深度
      Returns:
      this builder | 此构建器
    • maxEvaluationTime

      public DefaultSandbox.Builder maxEvaluationTime(long timeMs)
      Set max evaluation time 设置最大求值时间
      Parameters:
      timeMs - the max time in milliseconds | 最大时间(毫秒)
      Returns:
      this builder | 此构建器
    • allowAllByDefault

      public DefaultSandbox.Builder allowAllByDefault(boolean allow)
      Set allow all by default 设置默认允许所有
      Parameters:
      allow - true to allow by default | true表示默认允许
      Returns:
      this builder | 此构建器
    • build

      public DefaultSandbox build()
      Build the sandbox 构建沙箱
      Returns:
      the sandbox | 沙箱