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

model: Eliminate sorted collections #6235

Open
fviernau opened this issue Dec 14, 2022 · 3 comments · May be fixed by #8705
Open

model: Eliminate sorted collections #6235

fviernau opened this issue Dec 14, 2022 · 3 comments · May be fixed by #8705
Assignees
Labels
enhancement Issues that are considered to be enhancements model About the data model

Comments

@fviernau
Copy link
Member

The use of sorted collections has been introduced with the goal of having entries serialized in some sorted order.
This approach has the pitfall that it requires

  1. Model classes to implement the Comparable interface which
    • brings in contractual requirements with equals, which in turn adds complexity to the actual compareTo implementation
    • Tightly couples the sorting of the serializer with the model class
  2. Use mutable as opposed to immutable collections
  3. The client code to deal with sorted collections

It may be possible to arrive at the original goal without implementing Comparable interface / using sorted collection.
A concrete solution is not yet known but options need to be investigated / evaluated first.

@sschuberth sschuberth added enhancement Issues that are considered to be enhancements model About the data model labels Dec 14, 2022
@fviernau
Copy link
Member Author

copied hint from @sschuberth :

There's actually an existing issue in Jackson for making this easily configurable, see FasterXML/jackson-databind#3166.

@sschuberth
Copy link
Member

FYI, I'm working on a new proposal that uses Jackson converters to turn sets into sorted sets on serialization only. There are a few option questions about some technical details that could be discussed in an upcoming draft PR.

@sschuberth
Copy link
Member

FYI, I'm working on a new proposal that uses Jackson converters to turn sets into sorted sets on serialization only.

See #6244.

There are a few option questions about some technical details that could be discussed in an upcoming draft PR.

Or maybe we can discuss the options in our Monday meeting.

sschuberth added a commit that referenced this issue Mar 7, 2023
See #6235 for context.

Signed-off-by: Sebastian Schuberth <[email protected]>
sschuberth added a commit that referenced this issue Mar 7, 2023
See #6235 for context. Here, the use of `StringSortedSetConverter` is
not required, as `ImportCopyrightGarbageCommand` is the only place that
serializes the class, and that uses its own `Collator` for custom
sorting.

Signed-off-by: Sebastian Schuberth <[email protected]>
sschuberth added a commit that referenced this issue Mar 8, 2023
See #6235 for context. Here, the use of `StringSortedSetConverter` is
not required, as `ImportCopyrightGarbageCommand` is the only place that
serializes the class, and that uses its own `Collator` for custom
sorting.

Signed-off-by: Sebastian Schuberth <[email protected]>
@sschuberth sschuberth pinned this issue Apr 27, 2023
@tsteenbe tsteenbe unpinned this issue Nov 3, 2023
@fviernau fviernau self-assigned this May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issues that are considered to be enhancements model About the data model
Projects
None yet
2 participants