Reputation: 435
I need to do Money calculations in my application that is java 8. Since the operations i need to do are basic operations, i am considering creating my own money class. But looking at the long term i see Java9 has its own Money implementation which we might want to migrate to when we move our application to java 9.
Is there anyway i can use JSR 354 implementation for money in Java 8? if yes, would that be the recommended way right now to do Money in Java 8 right now? https://jcp.org/aboutJava/communityprocess/final/jsr354/index.html
EDIT: I was wrong, JSR 354 is not in Java 9. But my question still stands on how to use Money in Java 8 and is this the recommended way to deal with Money in jAva.
Upvotes: -2
Views: 1926
Reputation: 1108
Basically, there is two way to use it:
in your pom.xml
<dependency>
<groupId>org.javamoney</groupId>
<artifactId>moneta</artifactId>
<version>0.9</version>
</dependency>
in your pom.xml
<dependency>
<groupId>javax.money</groupId>
<artifactId>money-api</artifactId>
<version>1.0.1</version>
</dependency>
Upvotes: 4