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

Properties: Superseded PropertyValues by Elementa's States (concept) #46

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

UserTeemu
Copy link
Contributor

A concept implementation for using Elementa's State objects for storing values of properties.

I was inspired to do this PR from improving #25 . The ability to have multiple listeners/actions added in this PR would help getting that other PR ready.

Major changes in this PR:

  • PropertyValues are moved into their own file.
  • Vigilance's PropertyValues become deprecated.
    • PropertyValue#initialized and PropertyValue#writeDataToFile have been moved to PropertyData
  • Actions (that are ran when a value changes) have been internally replaced with State listeners.
    • Major difference is that there can now be multiple listeners. As a consequence, it will no longer allow you to remove one listener by setting another. More about this in a comment.
  • Button actions are no longer stored in callable property values. Rather, they are now ordinary value listeners. Listeners are invoked whenever a button is pressed.
  • Code of PropertyCollector#getProperty functions have been changed so that there would be less warnings caused by property values being deprecated.
    • Vigilant#registerListener functions were updated to use the PropertyCollector#getProperty function to find PropertyData instances. As a result, Vigilant#registerListener functions can now find more properties (instead of only Java field backed ones) and that code is cleaner.

All feedback is welcome. In the comments, I'll have a few things I especially want feedback on.

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.

1 participant