Package org.drools.ruleunits.api

## Interface RuleUnitProvider

- All Superinterfaces:
    `Comparable<KieService>`, `KieService`

      public interface RuleUnitProvider
      extends KieService

  A provider of `RuleUnit` and `RuleUnitInstance` from a given `RuleUnitData`.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface | Description
    --- | --- | ---
    `static class` | `RuleUnitProvider.Factory` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `default <T extends RuleUnitData> RuleUnitInstance<T>` | `createRuleUnitInstance​(T ruleUnitData)` | Creates a new `RuleUnitInstance` from the `RuleUnit` generated for the given `RuleUnitData`.
    `static RuleUnitProvider` | `get()` | Returns an instance of the RuleUnitProvider.
    `<T extends RuleUnitData> RuleUnit<T>` | `getRuleUnit​(T ruleUnitData)` | Provides the `RuleUnit` generated for the given `RuleUnitData`.

    - ### Methods inherited from interface org.kie.api.internal.utils.KieService

      `compareTo, servicePriority`

- - ### Method Detail

    - #### getRuleUnit

          <T extends RuleUnitData> RuleUnit<T> getRuleUnit​(T ruleUnitData)

      Provides the `RuleUnit` generated for the given `RuleUnitData`.
      Returns:
        The generated `RuleUnit` or null if there's no `RuleUnit` generated for the given `RuleUnitData`.

    - #### createRuleUnitInstance

          default <T extends RuleUnitData> RuleUnitInstance<T> createRuleUnitInstance​(T ruleUnitData)

      Creates a new `RuleUnitInstance` from the `RuleUnit` generated for the given `RuleUnitData`. This is equivalent to

           RuleUnitProvider.get().getRuleUnit(ruleUnitData).createInstance(ruleUnitData);

      throwing a runtime exception if there isn't any `RuleUnit` generated for the given `RuleUnitData`.

    - #### get

          static RuleUnitProvider get()

      Returns an instance of the RuleUnitProvider.