Class FractionConverter
java.lang.Object
org.apache.sis.internal.converter.ClassPair<S,T>
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 FractionConverterThe unique instance of this converter.private static final longFor 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, readResolveMethods 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:
uniquein 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:
inversein interfaceObjectConverter<Fraction,Integer> - Overrides:
inversein classSystemConverter<Fraction,Integer> - Returns:
- the inverse converter.
- See Also:
-