Skip to main content

Re: Add five methods in Quantity interface[Proposal]

  • From: Otávio Gonçalves de Santana < >
  • To:
  • Subject: Re: Add five methods in Quantity interface[Proposal]
  • Date: Fri, 31 Oct 2014 18:34:31 -0200

Ok.
The main goal of this method is make comparatives between Units such
minutes, hours, days, etc.

On Fri, Oct 31, 2014 at 6:23 PM, Werner Keil 
< >
 wrote:

> Well 310 is badly designed, we just heard about stuff it has mashed up
> between RI and API we plan to factor out similar to 354, but it is worth
> looking at what 354 does.
>
> One caveat is, that most of these methods say things like
> /** * Compares two instances of {@link MonetaryAmount}, hereby ignoring
> non significant trailing * zeroes and different numeric capabilities. * *
> @param amount the {@link MonetaryAmount} to be compared with this
> instance. * @return {@code true} if {@code amount == this}. * @throws
> MonetaryException if the amount's currency is not equals to the currency of
> this instance. */
> "Numeric capabilities" are not so extremely emphasized here, e.g. rounding
> modes, etc. are a reason why 354 ended up a separate JSR more specialized
> for financial operations.
>
> Werner
>
> On Fri, Oct 31, 2014 at 9:14 PM, Otávio Gonçalves de Santana <
>  >
>  wrote:
>
>> Yes, there is some thing like this in JSR 354 and JSR 310:
>>
>> In JSR 354:
>>
>https://github.com/JavaMoney/jsr354-api/blob/master/src/main/java/javax/money/MonetaryAmount.java
>>
>>
>> On Fri, Oct 31, 2014 at 5:55 PM, Werner Keil 
>> < >
>> wrote:
>>
>>> Let's have a look at it after the actual place of any such method is
>>> clarified.
>>> Feel free to create a JIRA ticket at any time.
>>>
>>> Do they match JavaMoney (JSR 354/Moneta) equivalents btw.?
>>> It's good to have that in JIRA, we'll figure our, if this helps on an
>>> API level or otherwise for RI.
>>>
>>> Thanks,
>>> Werner
>>>
>>> On Fri, Oct 31, 2014 at 8:36 PM, Otávio Gonçalves de Santana <
>>>  >
>>>  wrote:
>>>
>>>> I would like to propose to add four new comparatives methods in
>>>> Quantity interface:
>>>>
>>>>
>>>>    -   boolean isGreaterThan(Quantity<T> quantity);
>>>>    -   boolean isGreaterThanOrEqualTo(Quantity<T> quantity);
>>>>    -   boolean isLessThan(Quantity<T> quantity);
>>>>    -   boolean isLessThanOrEqualTo(Quantity<T> quantity);
>>>>    -   boolean isEquivalentTo(Quantity<T> quantity);
>>>>
>>>> The implementation should convert to the same unit and than compare.
>>>> So:
>>>>
>>>> Quantity<Time> oneHour = ...
>>>> Quantity<Time> sixtyMinutes = ...
>>>>
>>>> Should return true, when: oneHour.isEquivalentTo(sixtyMinutes);
>>>> --
>>>> Otávio Gonçalves de Santana
>>>>
>>>> blog:     http://otaviosantana.blogspot.com.br/
>>>> twitter: http://twitter.com/otaviojava
>>>> site:     *http://about.me/otaviojava ;<http://about.me/otaviojava>*
>>>> 55 (11) 98255-3513
>>>>
>>>>
>>>
>>
>>
>> --
>> Otávio Gonçalves de Santana
>>
>> blog:     http://otaviosantana.blogspot.com.br/
>> twitter: http://twitter.com/otaviojava
>> site:     *http://about.me/otaviojava ;<http://about.me/otaviojava>*
>> 55 (11) 98255-3513
>>
>>
>


-- 
Otávio Gonçalves de Santana

blog:     http://otaviosantana.blogspot.com.br/
twitter: http://twitter.com/otaviojava
site:     *http://about.me/otaviojava ;<http://about.me/otaviojava>*
55 (11) 98255-3513


Add five methods in Quantity interface[Proposal]

Otávio Gonçalves de Santana 10/31/2014

Re: Add five methods in Quantity interface[Proposal]

Werner Keil 10/31/2014

Re: Add five methods in Quantity interface[Proposal]

Otávio Gonçalves de Santana 10/31/2014

Re: Add five methods in Quantity interface[Proposal]

Otávio Gonçalves de Santana 10/31/2014

Re: Add five methods in Quantity interface[Proposal]

Werner Keil 10/31/2014

Re: Add five methods in Quantity interface[Proposal]

Otávio Gonçalves de Santana 10/31/2014

Re: Add five methods in Quantity interface[Proposal]

Werner Keil 10/31/2014
 
 
Close
loading
Please Confirm
Close