Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added annotation as method is part of dynamic rule #178

Closed
wants to merge 3 commits into from

Conversation

kuimovvg
Copy link
Contributor

@kuimovvg kuimovvg commented Oct 9, 2023

What do you think about slightly changing the approach to declaring and creating dynamic rules?

@kuimovvg
Copy link
Contributor Author

kuimovvg commented Oct 9, 2023

rule is like

public class TestDynamicRule extends JRule {
    public TestDynamicRule() {
        super(false);
    }
    @JRuleName(value = "MyDynamichRule", isDynamic = true)
    @JRuleWhenItemChange(item = MyTestSwitch, to = "OFF", from = "ON")
    public void execOffToOnRule() {
        logInfo("||||| --> Ya");
    }
}

and creation is like

TestDynamicRule rule = new TestDynamicRule();
Method method = rule.getClass().getMethods()[0];
JRuleEngine.get().addDynamic(method, rule);

@seaside1
Copy link
Owner

seaside1 commented Oct 9, 2023

I think that would work. I will test it out shortly.

@kuimovvg kuimovvg mentioned this pull request Oct 9, 2023
@kuimovvg kuimovvg marked this pull request as ready for review October 10, 2023 08:35
@seaside1
Copy link
Owner

The problem I see with this is that the annotations makes it not be fully dynamic. If you look at the implementation I made for the sonos-jrule, I have dynamic trigger for items as well. I think we could add this but it should not replace the existing dynamic load.

@kuimovvg
Copy link
Contributor Author

I agree, he is also needed. Inattentively I looked at the functionality from sonos-jrule. Return the addDynamicWhenReceivedCommand method in my PR?

@seaside1
Copy link
Owner

@kuimovvg Sorry for being absent. Worklife has been hectic lately. I would like to merge the original dynamic rules PR first, and then test this out.

@seaside1 seaside1 deleted the branch seaside1:dynamic-rules February 9, 2024 12:46
@seaside1 seaside1 closed this Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants