Package org.openhab.core.i18n
Interface UnitProvider
@NonNullByDefault
public interface UnitProvider
Provides
Units and the current SystemOfUnits.- Author:
- Henning Treu - Initial contribution
-
Method Summary
Modifier and TypeMethodDescriptionCollection<Class<? extends javax.measure.Quantity<?>>> javax.measure.spi.SystemOfUnitsReturns theSystemOfUnitswhich is currently set, must not be null.<T extends javax.measure.Quantity<T>>
javax.measure.Unit<T> Retrieves the defaultUnitfor the givenQuantityaccording to the currentSystemOfUnits.
-
Method Details
-
getUnit
<T extends javax.measure.Quantity<T>> javax.measure.Unit<T> getUnit(Class<T> dimension) throws IllegalArgumentException Retrieves the defaultUnitfor the givenQuantityaccording to the currentSystemOfUnits.- Parameters:
dimension- TheQuantity, called dimension here, defines the base unit for the retrieved unit. E.g. callgetUnit(javax.measure.quantity.Temperature.class)to retrieve the temperature unit according to the currentSystemOfUnits.- Returns:
- The
Unitmatching the givenQuantity - Throws:
IllegalArgumentException- when the dimension is unknown
-
getMeasurementSystem
javax.measure.spi.SystemOfUnits getMeasurementSystem()Returns theSystemOfUnitswhich is currently set, must not be null.- Returns:
- the
SystemOfUnitswhich is currently set, must not be null.
-
getAllDimensions
Collection<Class<? extends javax.measure.Quantity<?>>> getAllDimensions()
-