Class WktUnitFormat

  • All Implemented Interfaces:
    UnitFormatter

    public final class WktUnitFormat
    extends BaseUnitFormatter
    UnitFormat configured to parse units. Since usually we don't know the citation in use for a particular unit literal definition, this format includes the aliases of EPSG and ESRI citations, in order to be able to parse the widest possible range of units.
    • Method Detail

      • addLabel

        public void addLabel​(Unit<?> unit,
                             String label)
        Description copied from class: BaseUnitFormatter
        Attaches a system-wide label to the specified unit. For example: SimpleUnitFormat.getInstance().label(DAY.multiply(365), "year"); SimpleUnitFormat.getInstance().label(METER.multiply(0.3048), "ft"); If the specified label is already associated to a unit the previous association is discarded or ignored. The old label is overwritten for labeling/ purposes, but it remains like an alias (it still works for parsing)
        Overrides:
        addLabel in class BaseUnitFormatter
        Parameters:
        unit - the unit being labeled.
        label - the new label for this unit.
      • getEquivalentUnit

        public <Q extends Quantity<Q>> Unit<Q> getEquivalentUnit​(Unit<Q> unit)
        Returns an equivalent unit instance based on the provided unit. First, it tries to get one of the reference units defined in the JSR 385 implementation in use. If no equivalent reference unit is defined, it returns the provided unit