Skip to main content

[JSR-354] Re: MonetaryFunction, MonetaryAdjuster

  • From: Anatole Tresch <atsticks@...>
  • To: Jsr 354 JavaMoney Public Mailinglist <jcurrency_mail@...>
  • Subject: [JSR-354] Re: MonetaryFunction, MonetaryAdjuster
  • Date: Sun, 14 Apr 2013 15:39:59 +0200

Good point, I also was stumbling upon, but it was too late in the night, to think on a better name, so lets go for MonetaryOperator, yes!

Cheers,
Anatole


2013/4/14 Werner Keil <werner.keil@...>
Anatole/all,

Thanks for the update. I synced up the latest code from Git and it looks promising.
I am not convinced, that all these cases other than arithmetics match the term MonetaryAdjuster, nor that the separate interface was entirely necessary, just take Rounding we had before, it is a code- and function-less extension of MonetaryFunction.

At most, what JDK got in a similar way is the sub-interface 

 UnaryOperator<T>

Maybe MonetaryOperator (if it's always MonetaryAmount, we may not need generics) could be better. For a pure Java 9 internal version of the Spec some day Function could take the place of MonetaryFunction, but for a standalone precursor (or all apps using Java 7 or even 6 ) this is necessary and makes sense.

JavaDoc of e.g. the MajorPart
 * This class allows to extract the major part of a {@link MonetaryAmount}
 * instance.

sounds nothing like "adjust" at all, hence maybe MonetaryOperator could be better? 
Using the apply() method of the base interface is of course a good thing and makes the actual name of the "intermediary" interface not so relevant.

Cheers,
Werner


On Sat, Apr 13, 2013 at 9:59 PM, Anatole Tresch <atsticks@...> wrote:
Hi all

As shortly discussed I factored out some of the monetary functions from amount, using a MonetaryFunction (which is similar to java.util.function). MonetaryAdjuster extends this interface similarly. Additionally I factored out Minimum, Maximum, MinorPart, MajorPart and also some additional functions. Also I added visitor and filter support for MonetaryAmounts, using arbitrary predicates.
This additionaly will greatly enhance our JSR and also prepare it for future extensions, based on Java 8.
Have a look and comment.

Cheers,
Anatole

--
Anatole Tresch
Java Lead Engineer, JSR Spec Lead
Glärnischweg 10
CH - 8620 Wetzikon

Switzerland, Europe Zurich, GMT+1
Twitter:  @atsticks
Google: atsticks
Phone   +41-44 334 40 87
Mobile  +41-76 344 62 79




--
Anatole Tresch
Java Lead Engineer, JSR Spec Lead
Glärnischweg 10
CH - 8620 Wetzikon

Switzerland, Europe Zurich, GMT+1
Twitter:  @atsticks
Google: atsticks
Phone   +41-44 334 40 87
Mobile  +41-76 344 62 79


[JSR-354] MonetaryFunction, MonetaryAdjuster

Anatole Tresch 04/13/2013

[JSR-354] Re: MonetaryFunction, MonetaryAdjuster

Werner Keil 04/14/2013

[JSR-354] Re: MonetaryFunction, MonetaryAdjuster

Anatole Tresch 04/14/2013
 
 
Close
loading
Please Confirm
Close