Class TransformedUnit<Q extends Quantity<Q>>

  • Type Parameters:
    Q - The type of the quantity measured by this unit.
    All Implemented Interfaces:
    Serializable, Comparable<Unit<Q>>, Unit<Q>, tech.uom.lib.common.function.Nameable, tech.uom.lib.common.function.PrefixOperator<Q>, tech.uom.lib.common.function.SymbolSupplier, tech.uom.lib.common.function.UnitConverterSupplier

    public final class TransformedUnit<Q extends Quantity<Q>>
    extends AbstractUnit<Q>
    implements tech.uom.lib.common.function.UnitConverterSupplier

    This class represents the units derived from other units using converters.

    Examples of transformed units: CELSIUS = KELVIN.shift(273.15); FOOT = METRE.multiply(3048).divide(10000); MILLISECOND = MILLI(SECOND);

    Transformed units have no symbol. But like any other units, they may have labels attached to them (see UnitFormat.label

    Instances of this class are created through the AbstractUnit.transform(javax.measure.UnitConverter) method.

    Since:
    1.0
    Version:
    2.0, March 1, 2020
    Author:
    Jean-Marie Dautelle, Werner Keil
    See Also:
    Serialized Form
    • Constructor Detail

      • TransformedUnit

        public TransformedUnit​(Unit<Q> parentUnit,
                               UnitConverter unitConverter)
        Creates a transformed unit from the specified system unit. using the parent as symbol
        Parameters:
        parentUnit - the system unit from which this unit is derived.
        converter - the converter to the parent units.
      • TransformedUnit

        public TransformedUnit​(String symbol,
                               String name,
                               Unit<Q> parentUnit,
                               UnitConverter unitConverter)
        Creates a transformed unit from the specified parent unit.
        Parameters:
        symbol - the symbol to use with this transformed unit.
        name - the name to use with this transformed unit.
        parentUnit - the parent unit from which this unit is derived.
        unitConverter - the converter to the parent units.
        Since:
        2.0
      • TransformedUnit

        public TransformedUnit​(String symbol,
                               Unit<Q> parentUnit,
                               UnitConverter unitConverter)
        Creates a transformed unit from the specified parent unit.
        Parameters:
        symbol - the symbol to use with this transformed unit.
        parentUnit - the parent unit from which this unit is derived.
        unitConverter - the converter to the parent units.
      • TransformedUnit

        public TransformedUnit​(String symbol,
                               String name,
                               Unit<Q> parentUnit,
                               Unit<Q> sysUnit,
                               UnitConverter unitConverter)
        Creates a transformed unit from the specified parent and system unit. using a specific symbol and name.
        Parameters:
        symbol - the symbol for this unit.
        name - the name for this unit.
        parentUnit - the parent unit from which this unit is derived.
        sysUnit - the system unit which this unit is based on.
        converter - the converter to the parent units.
        Since:
        2.0
      • TransformedUnit

        public TransformedUnit​(String symbol,
                               Unit<Q> parentUnit,
                               Unit<Q> sysUnit,
                               UnitConverter unitConverter)
        Creates a transformed unit from the specified parent and system unit. using a specific symbol.
        Parameters:
        symbol - the symbol for this unit.
        parentUnit - the parent unit from which this unit is derived.
        sysUnit - the system unit which this unit is based on.
        converter - the converter to the parent units.