Class FractionConverter.FromInteger
java.lang.Object
org.apache.sis.internal.converter.ClassPair<S,T>
org.apache.sis.internal.converter.SystemConverter<Integer,Fraction>
org.apache.sis.internal.converter.FractionConverter.FromInteger
- All Implemented Interfaces:
Serializable,Function<Integer,,Fraction> ObjectConverter<Integer,Fraction>
- Enclosing class:
- FractionConverter
The inverse of
FractionConverter.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FractionConverter.FromIntegerThe 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
-
FromInteger
public FromInteger()Creates a new converter. Only one instance is enough, but this constructor needs to be public for allowing invocation byServiceLoader.
-
-
Method Details
-
unique
Description copied from class:SystemConverterReturns an unique instance of this converter if one exists. If a converter already exists for the same source an target classes, then this converter is returned. Otherwise this converter is returned without being cached.- Overrides:
uniquein classSystemConverter<Integer,Fraction> - Returns:
- the unique instance, or
thisif no unique instance can be found. - See Also:
-
inverse
Description copied from class:SystemConverterDefault to non-invertible conversion. Must be overridden by subclasses that support inversions.- Specified by:
inversein interfaceObjectConverter<Integer,Fraction> - Overrides:
inversein classSystemConverter<Integer,Fraction> - Returns:
- a converter for converting instances of T back to instances of S.
- See Also:
-
properties
Description copied from interface:ObjectConverterReturns the manner in which source values (S) are mapped to target values (T). Some possible function properties are:- Injective if no pair of S can produce
the same T value (e.g.: conversions from
IntegertoString). - Surjective if every values of T can be
created from one or many values of S (e.g.: conversions from
StringtoInteger). - Bijective if there is a one-to-one relationship between the S and T values.
- Order preserving if any sequence of
increasing S values (in the sense of
Comparable) is mapped to a sequence of increasing T values. - Order reversing if any sequence of
increasing S values (in the sense of
Comparable) is mapped to a sequence of decreasing T values.
ObjectConverter.apply(Object)method returnsnullfor unconvertible source values, then this properties set cannot containFunctionProperty.INJECTIVEbecause more than one source value could be converted to the samenulltarget value.- Returns:
- the manners in which source values are mapped to target values. May be an empty set, but never null.
- Injective if no pair of S can produce
the same T value (e.g.: conversions from
-
apply
Creates a new fraction from the given integer.- Parameters:
value- the integer to convert.- Returns:
- a fraction equals to the given integer.
-