Closed schleichardt closed 9 years ago
Joda rules the world ;) @schleichardt Can you check how it handles floating point numbers that are smaller than one cent as Sphere does only support full cents at the moment.
In the old SDK sometimes (I wonder why not everywhere) the Java class Currency is used, for example here: https://github.com/commercetools/sphere-play-sdk/blob/5456d2057c4423d617ba7cc5bf11b516a79baa10/java-client/src/main/java/io/sphere/client/shop/model/LineItemContainer.java#L128
I agree the String for currency code is not nice at all, we should use a class for that. Which one, I don't have any preference.
If you want to work with money and currency in java then JSR 354 is the way to go, in my opinion.
But we are on Java 8, not on Java 9 draft, so JSR 354 ist not an option, yet.
It's actually very viable solution. i already used it in several java 6 and java 7 projects. Even though it is not included in JDK yet, you can already use it as a java library:
It's hosted on github and available in maven central:
Reference implantation: http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22moneta%22 API: http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22money-api%22
Okay, we go this way.
"org.javamoney" % "moneta" % "0.8"
:+1:
:+1:
Cool 0.9 is available.
I actually was on this presentation. It was pretty cool (bedconf 2013). I think you can also find some videos of it.
Best regards, Oleg
On 02 Oct 2014, at 09:53, Michael Schleichardt notifications@github.com wrote:
http://bed-con.org/2013/wp-content/uploads/2013/04/JSR354-CSLayout_en_CD.pdf
— Reply to this email directly or view it on GitHub.
@lauraluiz @OlegIlyenko
Currently the currency code of money is typed as String. Should we change this? http://www.joda.org/joda-money/ uses also a special type.
Javadoc: http://sphereio.github.io/sphere-jvm-sdk/javadoc/master/io/sphere/sdk/models/Money.html