Interface StatelessSession

    • Method Detail

      • fire

        void fire​(BiConsumer<FactHandle,​Object> consumer)

        Fires the session and calls the consumer for each memory object and its fact handle.

        Parameters:
        consumer - consumer for session memory
      • fire

        Void fire()

        Fires the session and performs no memory scan. This method might be useful if developer is holding references to fact variables and only interested in changes of those facts:

        
         Customer c = new Customer();
         session.insert(c);
         session.fire();
         Log.info(c.getSomeUpdatedProperty());
         

        While this method is the easiest among the other fire(..) methods, it is only applicable if the provided FactStorage SPI implementation stores facts by reference (e.g. does not serialize/deserialize objects). The default implementation does not serialize or otherwise transform fact instances

        Specified by:
        fire in interface RuleSession<StatelessSession>
      • fire

        default void fire​(Predicate<Object> filter,
                          Consumer<Object> consumer)

        Fires the session and calls the consumer for each memory object that satisfies given filter

        Parameters:
        consumer - consumer for session memory
        filter - filtering predicate
      • fire

        void fire​(Consumer<Object> consumer)

        Fires the session and calls the consumer for each memory object.

        Parameters:
        consumer - consumer for session memory
      • fire

        <T> void fire​(String type,
                      Consumer<T> consumer)

        A convenience method to retrieve facts of a specific type name.

        Parameters:
        consumer - consumer for session memory
      • fire

        default <T> void fire​(String type,
                              Predicate<T> filter,
                              Consumer<T> consumer)

        A convenience method to retrieve facts of a specific type name and matching given predicate

        Parameters:
        consumer - consumer for session memory
        filter - filtering predicate
      • fire

        <T> void fire​(Class<T> type,
                      Consumer<T> consumer)

        A convenience method to retrieve the resulting instances of a specific Java class.

        Parameters:
        consumer - consumer for session memory
      • fire

        default <T> void fire​(Class<T> type,
                              Predicate<T> filter,
                              Consumer<T> consumer)

        A convenience method to retrieve facts of a specific Java type and matching given predicate

        Parameters:
        consumer - consumer for session memory
        filter - filtering predicate
      • insertAndFire

        default void insertAndFire​(Object... objects)
      • insertAndFire

        default void insertAndFire​(Iterable<Object> objects)