Class Config.Builder

java.lang.Object
org.dellroad.javabox.Config.Builder
Enclosing class:
Config

public static class Config.Builder extends Object
Builder for Config instances.

Instances are thread safe.

  • Method Details

    • build

      public Config build()
      Build the Config.
      Returns:
      new Config
    • withJShellMods

      public Config.Builder withJShellMods(Consumer<? super JShell.Builder> configurer)
      Apply a modification to the JShell.Builder that will be used to create the JShell instance.

      The given modification will not actually be applied until build() is invoked. Modifications are applied in the same order as this method is invoked.

      Parameters:
      configurer - JShell builder configurer
      Throws:
      IllegalArgumentException - if jshellBuilder is null
    • withJShellBuilder

      public Config.Builder withJShellBuilder(JShell.Builder jshellBuilder)
      Provide a custom JShell.Builder to be used to create the JShell instance.

      For experts only.

      Parameters:
      jshellBuilder - JShell builder
      Throws:
      IllegalArgumentException - if jshellBuilder is null
    • withDelegateLoader

      public Config.Builder withDelegateLoader(ClassLoader delegateLoader)
      Configure the ClassLoader to be used as the delegate loader of the loader that loads the classes generated for applied scripts.

      The default value is the current thread's context class loader at the point this builder is instantiated.

      Parameters:
      delegateLoader - delegate ClassLoader, or null for the system class loader
    • withControls

      public Config.Builder withControls(List<Control> controls)
      Configure the list of Controls.

      In general, controls are applied in the order the appear in the list. For example, if a control modifies bytecode, it will see the modifications of all controls earlier in the list.

      The default value is an empty list.

      Parameters:
      controls - list of controls
      Throws:
      IllegalArgumentException - if controls or any element therein is null
    • withControl

      public Config.Builder withControl(Control control)
      Add a Control to the current list of Controls.
      Parameters:
      control - script control
      Throws:
      IllegalArgumentException - if control is null