Skip to main content

[JSR-354] Re: MonetaryFunction, MonetaryAdjuster

  • From: Werner Keil <werner.keil@...>
  • To: jcurrency_mail@...
  • Subject: [JSR-354] Re: MonetaryFunction, MonetaryAdjuster
  • Date: Sun, 14 Apr 2013 14:00:02 +0200


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 


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.


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.


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
Please Confirm