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 TypeMethodDescriptionjavax.measure.spi.SystemOfUnits
Returns theSystemOfUnits
which is currently set, must not be null.<T extends javax.measure.Quantity<T>>
@Nullable javax.measure.Unit<T>Retrieves the defaultUnit
for the givenQuantity
according to the currentSystemOfUnits
.
-
Method Details
-
getUnit
<T extends javax.measure.Quantity<T>> @Nullable javax.measure.Unit<T> getUnit(@Nullable Class<T> dimension) 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
,null
otherwise.
-
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.
-