Class ZenEngineBuilder

java.lang.Object
io.gorules.zen.ZenEngineBuilder

public class ZenEngineBuilder extends Object
Builder for creating ZenEngineWrapper instances with fluent API.
  • Method Details

    • create

      public static ZenEngineBuilder create()
      Create a new builder instance.
      Returns:
      New ZenEngineBuilder
    • withFilesystemLoader

      public ZenEngineBuilder withFilesystemLoader(String rootPath)
      Use filesystem loader with given root directory.
      Parameters:
      rootPath - Root directory containing decision files
      Returns:
      this builder
    • withClasspathLoader

      public ZenEngineBuilder withClasspathLoader(String rootPath)
      Use classpath loader with given root path.
      Parameters:
      rootPath - Root classpath path (e.g., "decisions/" or "/decisions/")
      Returns:
      this builder
    • withMemoryLoader

      public ZenEngineBuilder withMemoryLoader()
      Use in-memory loader. Decisions must be added programmatically.
      Returns:
      this builder
    • withApiLoader

      public ZenEngineBuilder withApiLoader(String baseUrl)
      Use API loader with given base URL. Loads decisions from HTTP API.
      Parameters:
      baseUrl - Base URL for API (e.g., "https://api.example.com/decisions")
      Returns:
      this builder
    • withApiLoader

      public ZenEngineBuilder withApiLoader(String baseUrl, String bearerToken)
      Use API loader with given base URL and Bearer token. Convenience method for common authentication pattern.
      Parameters:
      baseUrl - Base URL for API
      bearerToken - Bearer token for Authorization header
      Returns:
      this builder
    • withApiLoader

      public ZenEngineBuilder withApiLoader(ApiLoaderConfig config)
      Use API loader with full configuration. Allows complete control over headers, timeout, retries, etc.
      Parameters:
      config - API loader configuration
      Returns:
      this builder
    • withLoader

      public ZenEngineBuilder withLoader(DecisionLoader loader)
      Use a custom decision loader.
      Parameters:
      loader - Custom loader implementation
      Returns:
      this builder
    • withMaxDepth

      public ZenEngineBuilder withMaxDepth(int maxDepth)
      Set maximum evaluation depth.
      Parameters:
      maxDepth - Maximum depth (default: 5)
      Returns:
      this builder
    • withTracing

      public ZenEngineBuilder withTracing(boolean enable)
      Enable or disable tracing by default.
      Parameters:
      enable - true to enable tracing
      Returns:
      this builder
    • build

      public ZenEngineWrapper build()
      Build the ZenEngineWrapper instance.
      Returns:
      configured ZenEngineWrapper