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

Allow Property impl to transform value before setting #355

Open
ljacqu opened this issue Aug 20, 2023 · 0 comments
Open

Allow Property impl to transform value before setting #355

ljacqu opened this issue Aug 20, 2023 · 0 comments
Labels
architecture Difficult architectural questions
Milestone

Comments

@ljacqu
Copy link
Member

ljacqu commented Aug 20, 2023

A property like LowercaseStringSetProperty or any other property type where not every value of the Java type is considered valid, proper validation/transformation happens when values are loaded from the resource, but if a property's value is programmatically set later on, no such validation occurs. While there is Property#isValidValue and it gets called when a value is set, this makes the SettingsManager throw an exception if it's false.

Ideally, values are valid when the application sets them for a property, but it might make sense to promote the idea that properties manage their values a bit more by maybe allowing the property to slightly transform the value (or throw if the value is unusable) also when a property's value is set by the application.

Examples:

  • A set with upper-case text is set for a LowercaseStringSetProperty
  • A collection is provided for any collection property where one of the entries is null (I believe nothing checks this at all at the moment)
  • InlineArrayProperty does not escape the chosen delimiter in the value -> would need to be done by the developer himself
@ljacqu ljacqu added this to the 2.0.0 milestone Aug 21, 2023
@ljacqu ljacqu added the architecture Difficult architectural questions label Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
architecture Difficult architectural questions
Development

No branches or pull requests

1 participant