Class DateConverter.Inverse
java.lang.Object
org.apache.sis.internal.converter.ClassPair<S,T>
org.apache.sis.internal.converter.SystemConverter<Long,Date>
org.apache.sis.internal.converter.DateConverter.Inverse
- All Implemented Interfaces:
Serializable
,Function<Long,
,Date> ObjectConverter<Long,
Date>
- Enclosing class:
- DateConverter<T>
Converter from
Long
to Date
.
This converter is not registered by ConverterRegistry.initialize()
.
Instead, SystemRegistry
will fetch it when first needed by looking at the inverse
of DateConverter.Long
. The same is true for all inverse converters defined in the
DateConverter
enclosing class.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SystemConverter<Date,
Long> private static final long
Fields inherited from class org.apache.sis.internal.converter.ClassPair
sourceClass, targetClass
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConverts the given object from the source type S to the target type T.inverse()
Default to non-invertible conversion.Returns the manner in which source values (S) are mapped to target values (T).unique()
Returns an unique instance of this converter if one exists.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 serialVersionUID- See Also:
-
inverse
-
-
Constructor Details
-
Inverse
Inverse(SystemConverter<Date, Long> inverse)
-
-
Method Details
-
inverse
Description copied from class:SystemConverter
Default to non-invertible conversion. Must be overridden by subclasses that support inversions.- Specified by:
inverse
in interfaceObjectConverter<Long,
Date> - Overrides:
inverse
in classSystemConverter<Long,
Date> - Returns:
- a converter for converting instances of T back to instances of S.
- See Also:
-
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<Long,
Date> - Returns:
- the unique instance, or
this
if no unique instance can be found. - 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
Description copied from interface:ObjectConverter
Converts the given object from the source type S to the target type T. If the given object cannot be converted, then this method may either returnsnull
or throws an exception, at implementation choice (except for injective functions, which must throw an exception - see the class Javadoc for more discussion about function properties).Example: in Apache SIS implementation, converters fromString
toNumber
distinguish two kinds of unconvertible objects:- Null or empty source string result in a
null
value to be returned. - All other kind of unparsable strings results in an exception to be thrown.
""
value is unconvertible but nevertheless considered as part of the converter domain, and is mapped to "no number". All other unparsable strings are considered outside the converter domain.- Parameters:
target
- the object to convert, ornull
.- Returns:
- the converted object, or
null
.
- Null or empty source string result in a
-