The Unit of Measurement API provides a set of Java language programming interfaces for handling units and quantities.
The interfaces provide a layer which separates client code, that would call the API,
from library code, which implements the API.
The specification contains Interfaces and abstract classes with methods for unit operations:
* Checking of unit compatibility
* Expression of a quantity in various units
* Arithmetic operations on units
You can access the API by adding the following Maven dependencies:
For JSR 363 use
<dependency> <groupId>javax.measure</groupId> <artifactId>unit-api</artifactId> <version>2.0</version> </dependency>
Further versions can be found here.
Release artifacts should be accessible from the following repositories:
- Maven Central
- JCenter by Bintray
Though it is possible to only reference the API from your application, you should also add an implementation like the Indriya reference implementation. On the other hand you may leave the API out if you already declare Indriya, especially using the JPMS (Jigsaw) since the implementation also declares Unit-API as a "transitive" dependency.