Package org.geotools.measure
Class WktUnitFormat
- Object
-
- BaseUnitFormatter
-
- 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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLabel(Unit<?> unit, String label)
Attaches a system-wide label to the specified unit.<Q extends Quantity<Q>>
Unit<Q>getEquivalentUnit(Unit<Q> unit)
Returns an equivalent unit instance based on the provided unit.static UnitFormatter
getInstance()
-
Methods inherited from class BaseUnitFormatter
addAlias, format, isUnitIdentifierPart, isValidIdentifier, nameFor, parse, parse, parseObject, parseProductUnit, parseSingleUnit, prefixFor, toString
-
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface UnitFormatter
format
-
-
-
-
Method Detail
-
getInstance
public static UnitFormatter getInstance()
-
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 classBaseUnitFormatter
- 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
-
-