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

Should we add ComparableQuantity.of()? #363

Closed
keilw opened this issue Feb 22, 2022 · 1 comment
Closed

Should we add ComparableQuantity.of()? #363

keilw opened this issue Feb 22, 2022 · 1 comment

Comments

@keilw
Copy link
Member

keilw commented Feb 22, 2022

Similar to the JDK Map or List interfaces, we could add a static method ComparableQuantity.of() to call directly on the interface.
It may seem as a convenience method at first, but would allow to explore further pushing such methods up into the API, where this could work as well, but possibly not before a major release (to be explored, potentially in a MR2)

@keilw keilw added the design label Feb 22, 2022
@keilw keilw added this to the 2.1.4 milestone Feb 22, 2022
@keilw
Copy link
Member Author

keilw commented Jul 13, 2022

Looking at Map.of() or List.of() in 20 or more variations of arguments, all of those are merely convenience methods for the ImmutableCollections. The method name is not self-descriptive because all of these should rather say ofImmutable() or similar, instead of just of(). That's bad naming and design and does not really add value over using the central Quantities factory class.

If there was a way, Quantity itself could tap into the SPI classes like QuantityFactory and have a static Quantity.of(Number, Unit) method, then that would make more sense in the API, but we'd have to find a generic way instead of having to pass the Class of the quantity type.

@keilw keilw closed this as completed Jul 13, 2022
@keilw keilw added this to JSR 385 MR2 Dec 7, 2022
@keilw keilw moved this to ✅ Done in JSR 385 MR2 Dec 7, 2022
@keilw keilw added the wontfix label Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

No branches or pull requests

1 participant