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.FromInteger
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
-
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:SystemConverter
Returns 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:
unique
in classSystemConverter<Integer,
Fraction> - Returns:
- the unique instance, or
this
if no unique instance can be found. - See Also:
-
inverse
Description copied from class:SystemConverter
Default to non-invertible conversion. Must be overridden by subclasses that support inversions.- Specified by:
inverse
in interfaceObjectConverter<Integer,
Fraction> - Overrides:
inverse
in classSystemConverter<Integer,
Fraction> - Returns:
- a converter for converting instances of T back to instances of S.
- See Also:
-
properties
Description copied from interface:ObjectConverter
Returns 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
Integer
toString
). - Surjective if every values of T can be
created from one or many values of S (e.g.: conversions from
String
toInteger
). - 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 returnsnull
for unconvertible source values, then this properties set cannot containFunctionProperty.INJECTIVE
because more than one source value could be converted to the samenull
target 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.
-