org.kie.api.runtime.rule

## Interface DataSource<T>

- All Superinterfaces:
    Iterable<T>

      public interface DataSource<T>
      extends Iterable<T>

  A DataSource is a source of the data processed by a given `RuleUnit`.

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T> DataSource<T>` | `create(T... items)` Creates a DataSource, optionally containing some items
    `void` | `delete(FactHandle handle)` Deletes the fact for which the given FactHandle was assigned
    `void` | `delete(Object object)` Deletes the given object from this DataSource
    `FactHandle` | `insert(T object)` Inserts a new fact into this DataSource
    `void` | `update(FactHandle handle, T object, String... modifiedProperties)` Updates the fact for which the given FactHandle was assigned with the new fact set as the second parameter in this method.

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, iterator, spliterator`

- - ### Method Detail

    - #### insert

          FactHandle insert(T object)

      Inserts a new fact into this DataSource
      Parameters:
        `object` - the fact to be inserted
      Returns:
        the fact handle created for the given fact

    - #### update

          void update(FactHandle handle,
                      T object,
                      String... modifiedProperties)

      Updates the fact for which the given FactHandle was assigned with the new fact set as the second parameter in this method. It is also possible to optionally specify the set of properties that have been modified.
      Parameters:
        `handle` - the FactHandle for the fact to be updated.
        `object` - the new value for the fact being updated.
        `modifiedProperties` - the list of the names of the object's properties modified by this update.

    - #### delete

          void delete(FactHandle handle)

      Deletes the fact for which the given FactHandle was assigned
      Parameters:
        `handle` - the handle whose fact is to be retracted.

    - #### delete

          void delete(Object object)

      Deletes the given object from this DataSource
      Parameters:
        `object` - the object to be deleted.

    - #### create

          static <T> DataSource<T> create(T... items)

      Creates a DataSource, optionally containing some items
      Parameters:
        `items` - the items contained in the DataSource.

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