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

Could we merge some or all of ComparableQuantity into Quantity? #96

Closed
keilw opened this issue Jun 12, 2018 · 5 comments
Closed

Could we merge some or all of ComparableQuantity into Quantity? #96

keilw opened this issue Jun 12, 2018 · 5 comments

Comments

@keilw
Copy link
Member

keilw commented Jun 12, 2018

Unlike key elements of JSR 354 (CurrencyUnit or MonetaryAmount) Quantity (as well as Unit) neither apply Comparable nor other interfaces like Serializable.
On an implementation level ComparableQuantity was introduced for that reason. While Serializable is questionable outside the implementation (also see #43 or how JSR 354 keeps it in the RI) Comparable and maybe at least some methods in ComparableQuantity could be beneficial to Quantity.

@otaviojava
Copy link
Member

The issue in the sort is what happens when we have different unit types in the list?
E.g.: day, hour, byte, km/h

IMHO: that should be outside of the API

@keilw
Copy link
Member Author

keilw commented Jun 13, 2018

Hard to say, the list could still be strongly typed with Quantity<Time> or Quantity<Speed> in such case. Implementing would still be in the RI but let's see what others think.

@otaviojava
Copy link
Member

If you create our list yes, however, java is Type Erasure. So we don't have any control about that.

@keilw
Copy link
Member Author

keilw commented Jun 14, 2018

Of course even JavaMoney has a hard time to compare multiple amounts in a list, if the CurrencyUnit is not the same. It could be done, but makes no sense without explicit conversion (which unlike UoM requires access to live exchange rates)

@keilw keilw added the wontfix label Jun 22, 2018
@keilw
Copy link
Member Author

keilw commented Jun 22, 2018

In the Hangout we found too little synergies or strong arguments for API inclusion, therefore leaving the interface in the RI for now.

@keilw keilw closed this as completed Jun 22, 2018
@keilw keilw removed the ready label Jun 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants