JSR 363 RI User Guide
  • Introduction
  • Overview
  • Supported Units
  • Abstract Base Classes
    • Abstract Quantity
    • AbstractUnit
  • Factory Accessors
    • Units
    • Quantities
  • Library
  • Formatting
  • Functional Elements
    • Conversion
  • RI Level SPI
    • Measurement Interface
    • Range Class
  • Non Functional Requirements
    • Preserving precision
  • Examples
    • Hurricane Wind Scale
    • Using Enums
Powered by GitBook
On this page
  1. Factory Accessors

Quantities

The reference implementation provides a singleton factory accessor class Quantities, like Collections and other similar classes in the JDK. This class is a “convenience” facade over having to retrieve a new instance of QuantityFactory via the SPI for obtaining new Quantity instances. Examples:

Qantity<Time> t = Quantities.getQuantity(12, MILLI(SECOND));
Quantity<Length> len = Quantities.getQuantity(34.5, KILO(METRE));
PreviousUnitsNextLibrary

Last updated 7 years ago