Package io.github.brantunger.unruly.api
Interface FactReference<T extends @Nullable Object>
- Type Parameters:
T- The object/value type of the fact. A fact's value can benull.
- All Known Implementing Classes:
Fact
public interface FactReference<T extends @Nullable Object>
A named value that rules run against. A rule sees the value under the fact's name, so a fact named
applicant is applicant in a condition or action. The value object isn't copied: a rule or a listener
gets the same object the fact holds.
A fact's name and value don't change: a FactStore keeps a fact under its name, and to change a value it
stores a new fact. Fact is the built-in implementation.
- See Also:
-
Method Summary
-
Method Details
-
getName
String getName()Gets the name of the fact.- Returns:
- The name
-
getValue
T getValue()Gets the value of the fact. A run calls it once, when it starts.If it throws,
run()orrunWithResult()throws that exception unchanged before any listener callback, so no listener hears of the run, and the engine doesn't log it; see Implementing FactStore.- Returns:
- The value, which can be
null
-