Package org.openhab.core.i18n
Interface UnitProvider
@NonNullByDefault
public interface UnitProvider
Provides
Unit
s and the current SystemOfUnits
.- Author:
- Henning Treu - Initial contribution
-
Method Summary
Modifier and TypeMethodDescriptionCollection<Class<? extends javax.measure.Quantity<?>>>
javax.measure.spi.SystemOfUnits
Returns theSystemOfUnits
which is currently set, must not be null.<T extends javax.measure.Quantity<T>>
javax.measure.Unit<T>Retrieves the defaultUnit
for the givenQuantity
according to the currentSystemOfUnits
.
-
Method Details
-
getUnit
<T extends javax.measure.Quantity<T>> javax.measure.Unit<T> getUnit(Class<T> dimension) throws IllegalArgumentException Retrieves the defaultUnit
for the givenQuantity
according 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
Unit
matching the givenQuantity
- Throws:
IllegalArgumentException
- when the dimension is unknown
-
getMeasurementSystem
javax.measure.spi.SystemOfUnits getMeasurementSystem()Returns theSystemOfUnits
which is currently set, must not be null.- Returns:
- the
SystemOfUnits
which is currently set, must not be null.
-
getAllDimensions
Collection<Class<? extends javax.measure.Quantity<?>>> getAllDimensions()
-