Class FractionConverter
java.lang.Object
org.apache.sis.internal.converter.ClassPair<Fraction,Integer>
org.apache.sis.internal.converter.SystemConverter<Fraction,Integer>
org.apache.sis.internal.converter.FractionConverter
- All Implemented Interfaces:
Serializable
,Function<Fraction,
,Integer> ObjectConverter<Fraction,
Integer>
Handles conversions from
Fraction
to other kind of numbers.- Since:
- 0.8
- Version:
- 0.8
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FractionConverter
The unique instance of this converter.private static final long
For cross-version compatibility.Fields inherited from class org.apache.sis.internal.converter.ClassPair
sourceClass, targetClass
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.sis.internal.converter.SystemConverter
bijective, equals, formatErrorMessage, getSourceClass, getTargetClass, readResolve
Methods inherited from class org.apache.sis.internal.converter.ClassPair
cast, hashCode, parentSource, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
INSTANCE
The unique instance of this converter.
-
-
Constructor Details
-
FractionConverter
public FractionConverter()Creates a new converter. Only one instance is enough, but this constructor needs to be public for allowing invocation byServiceLoader
.
-
-
Method Details
-
unique
Returns the unique instance of this converter.- Overrides:
unique
in classSystemConverter<Fraction,
Integer> - Returns:
- the unique instance of this converter.
- See Also:
-
properties
Declares that this converter is injective, surjective, invertible and preserve order.- Returns:
- the properties of this bijective converter.
-
apply
Converts the given fraction to an integer.- Parameters:
value
- the fraction to convert.- Returns:
- the given fraction as an integer.
- Throws:
UnconvertibleObjectException
- if the given fraction is not an integer.
-
inverse
Returns the converter from integers to fractions.- Specified by:
inverse
in interfaceObjectConverter<Fraction,
Integer> - Overrides:
inverse
in classSystemConverter<Fraction,
Integer> - Returns:
- the inverse converter.
- See Also:
-