Skip to content

Allow Property impl to transform value before setting #355

@ljacqu

Description

@ljacqu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    architectureDifficult architectural questions

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions