org.kie.api.runtime.rule

## Interface RuleUnitExecutor

-     public interface RuleUnitExecutor

  RuleUnitExecutor allows to execute different `RuleUnit`s.

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `RuleUnitExecutor` | `bind(KieBase kiebase)` Bind this executor to a `KieBase` in order to execute the units defined in it.
    `RuleUnitExecutor` | `bindVariable(String name, Object value)` Binds a variable to this executor with a given name.
    `static RuleUnitExecutor` | `create()` Creates a brand new RuleUnitExecutor
    `void` | `dispose()` Releases all the current executor resources, setting up the session for garbage collection.
    `KieSession` | `getKieSession()` Returns the `KieSession` internally used by this executor.
    `void` | `halt()` Requests the executor to stop running units.
    `<T> DataSource<T>` | `newDataSource(String name, T... items)` Creates a DataSource, optionally containing some items, and bind it this executor with the given name.
    `int` | `run(Class<? extends RuleUnit> ruleUnitClass)` Runs a RuleUnit of the given class.
    `int` | `run(RuleUnit ruleUnit)` Runs a RuleUnit of the given class.
    `void` | `runUntilHalt(Class<? extends RuleUnit> ruleUnitClass)` Runs until halt a RuleUnit of the given class.
    `void` | `runUntilHalt(RuleUnit ruleUnit)` Runs until halt a RuleUnit of the given class.

- - ### Method Detail

    - #### bind

          RuleUnitExecutor bind(KieBase kiebase)

      Bind this executor to a `KieBase` in order to execute the units defined in it.

    - #### getKieSession

          KieSession getKieSession()

      Returns the `KieSession` internally used by this executor.

    - #### run

          int run(Class<? extends RuleUnit> ruleUnitClass)

      Runs a RuleUnit of the given class.

    - #### run

          int run(RuleUnit ruleUnit)

      Runs a RuleUnit of the given class.

    - #### runUntilHalt

          void runUntilHalt(Class<? extends RuleUnit> ruleUnitClass)

      Runs until halt a RuleUnit of the given class.

    - #### runUntilHalt

          void runUntilHalt(RuleUnit ruleUnit)

      Runs until halt a RuleUnit of the given class.

    - #### halt

          void halt()

      Requests the executor to stop running units.

    - #### newDataSource

          <T> DataSource<T> newDataSource(String name,
                                          T... items)

      Creates a DataSource, optionally containing some items, and bind it this executor with the given name.
      Parameters:
        `name` - the name with which the newly created DataSource will be bound to this executor.
        `items` - the items contained in the DataSource.

    - #### bindVariable

          RuleUnitExecutor bindVariable(String name,
                                        Object value)

      Binds a variable to this executor with a given name. This named variable will be then injected into `RuleUnit`s executed on this executor using a naming convention.
      Parameters:
        `name` - the name with which the value will be bound to this executor.
        `value` - the value to bind.

    - #### dispose

          void dispose()

      Releases all the current executor resources, setting up the session for garbage collection. This method must always be called after finishing using the executor, or the engine will not free the memory used by the executor.

    - #### create

          static RuleUnitExecutor create()

      Creates a brand new RuleUnitExecutor

Copyright © 2001–2019 JBoss by Red Hat. All rights reserved.