Package org.apache.sis.measure
Class SystemUnit.DimToUnit
java.lang.Object
org.apache.sis.internal.converter.SurjectiveConverter<UnitDimension,SystemUnit<?>>
org.apache.sis.measure.SystemUnit.DimToUnit
- All Implemented Interfaces:
Serializable,Function<UnitDimension,,SystemUnit<?>> ObjectConverter<UnitDimension,SystemUnit<?>>
- Enclosing class:
- SystemUnit<Q extends javax.measure.Quantity<Q>>
private static final class SystemUnit.DimToUnit
extends SurjectiveConverter<UnitDimension,SystemUnit<?>>
implements Serializable
The converter for replacing the keys in the
SystemUnit.getBaseUnits() map from UnitDimension
instances to SystemUnit instances. We apply conversions on the fly instead of extracting the data in
a new map once for all because the copy may fail if an entry contains a rational instead of an integer power.
With on-the-fly conversions, the operation will not fail if the user never ask for that particular value.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final SystemUnit.DimToUnitThe unique instance used bySystemUnit.getBaseUnits().private static final longFor cross-version compatibility. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSystemUnit<?>apply(UnitDimension dim) Returns the unit associated to the given dimension, ornullif none.Returns the type of key values in the map returned byUnitDimension.getBaseDimensions().Class<SystemUnit<?>>Returns the type of key values in the map to be returned bySystemUnit.getBaseUnits().(package private) ObjectInvoked on deserialization for replacing the deserialized instance by the unique instance.Methods inherited from class org.apache.sis.internal.converter.SurjectiveConverter
inverse, properties, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
INSTANCE
The unique instance used bySystemUnit.getBaseUnits().
-
-
Constructor Details
-
DimToUnit
private DimToUnit()Constructor for the singletonINSTANCE.
-
-
Method Details
-
getSourceClass
Returns the type of key values in the map returned byUnitDimension.getBaseDimensions().- Specified by:
getSourceClassin interfaceObjectConverter<UnitDimension,SystemUnit<?>> - Returns:
- the type of objects to convert.
-
getTargetClass
Returns the type of key values in the map to be returned bySystemUnit.getBaseUnits().- Specified by:
getTargetClassin interfaceObjectConverter<UnitDimension,SystemUnit<?>> - Returns:
- the type of converted objects.
-
apply
Returns the unit associated to the given dimension, ornullif none.- Specified by:
applyin interfaceFunction<UnitDimension,SystemUnit<?>> - Specified by:
applyin interfaceObjectConverter<UnitDimension,SystemUnit<?>> - Parameters:
dim- the object to convert, ornull.- Returns:
- the converted object, or
null.
-
readResolve
Invoked on deserialization for replacing the deserialized instance by the unique instance.- Throws:
ObjectStreamException
-