JSR 354 provides a portable and extendible framework for handling of Money & Currency. The API
models monetary amounts and currencies in a platform independent and portable way, including well
defined extension points. It's API defines a simple yet flexible contract that enables users to choose
the implementation matching their target requirements best and having full control about the numeric state
at all stages during monetary processing.
The JSR is lead by Anatole Tresch / Trivadis (@atsticks), Werner Keil (@keilw) and Otavio Santana (@otaviojava)
You can access the API by adding the following Maven dependencies:
<dependency> <groupId>javax.money</groupId> <artifactId>money-api</artifactId> <version>1.0.3</version> </dependency>
Further versions can be found here.
The release artifacts should be accessible from the following repositories:
- Maven Central
- JCenter by Bintray
Though it is possible to compile your programs completely with the API, in most cases, you will also have to add an implementation, e.g. the Moneta reference implementation.
The API basically consists of four packages:
javax.moneycontains the main artifacts of the API, e.g. the interfaces for
MonetaryQuery, and the accessor singletons for amounts, currencies and roundings.
javax.money.convertcontains currency conversion logic.
javax.money.formatcontains the formatting logic, which has some similarities with
java.textbut relies more on immutable artifacts and builders.
javax.money.spicontains the service provider interfaces and the bootstrap logic, which allows to configure the API also within EE contexts (e.g. running it within a CDI container).
Since it a Java Specification Request check out out JSR's specification from the JSR 354 Detail Page.