Rule action persistence policies#8
Conversation
…urn a Rule that can be modified further, eg with a finishedTriggeringProcedure.
this prevents accidental modification of rules after the containing ruleengine starts getting used. also switch to a LinkedHashMap for storing rules and tweak some of the methods used in unit tests.
f8d72f3 to
5a4a3ae
Compare
|
|
||
| protected Rule addRule(String name, BooleanSupplier condition, Supplier<Procedure> action) { | ||
| Rule rule = new Rule(name, condition, action); | ||
| protected Rule addRule( |
There was a problem hiding this comment.
should we hold off on merging this PR until the RuleEngine API simplification goes through?
I think that would remove the need for a lot of these overloaded versions of addRule().
There was a problem hiding this comment.
n/m about the first paragraph since this is based on that other PR.. do you think we could reduce the overloading and let devs more simply specify a withRulePersistence if they want something other than ONCE_AND_HOLD (if we want that to be the default)?
There was a problem hiding this comment.
withRulePersistence seems weird to me, because withFinishedTriggeringProcedure is specifying a whole other action, whereas withRulePersistence would be modifying just the onTriggering action. i.e. it would be possible to say addRule(...).withFinishedTriggeringProcedure(...).withRulePersistence(...), which seems misleading.
does standard Java style discourage the use of overloads?
There was a problem hiding this comment.
not at all - there are just a lot of variants. it's too bad java doesn't have named and optoinal parameters. :)
just looked - there are articles like this that also speak to alternatives to method overloading when there are a larger number of parameters.
I'm fine either way - was just wondering how to keep this scalable esp if and as we do add more parameters.
There was a problem hiding this comment.
it's a good point. we can discuss again if we add more parameters
…implify-rule-engine-apis
…ngine-apis' into rcahoon/mf3-rule-persistence
…on/mf3-rule-persistence
Description
Allow the user to specify how the RuleEngine should handle a Rule's action when the action completes or the Rule stops triggering.
Original PR from 2024 repo: Team766/2024#146
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Be detailed so that your code reviewer can understand exactly how much and what kinds of testing were done, and which might still be worthwhile to do.