Class DateConverter<T>
java.lang.Object
org.apache.sis.internal.converter.ClassPair<Date,T>
org.apache.sis.internal.converter.SystemConverter<Date,T>
org.apache.sis.internal.converter.DateConverter<T>
- All Implemented Interfaces:
Serializable
,Function<Date,
,T> ObjectConverter<Date,
T>
- Direct Known Subclasses:
DateConverter.Long
,DateConverter.SQL
,DateConverter.Timestamp
Handles conversions from
Date
to various objects.
String representation
There is currently no converter betweenString
and Date
because the
date format is not yet defined (we are considering the ISO format for a future SIS version).
Special cases
The converter from dates to timestamps is not injective, because the same date could be mapped to many timestamps since timestamps have an additional nanoseconds field.Immutability and thread safety
This base class and all inner classes are immutable, and thus inherently thread-safe.- Since:
- 0.3
- Version:
- 0.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
Converter fromLong
toDate
.static final class
Converter fromDate
toLong
.static final class
FromDate
to SQLDate
.static final class
FromDate
to SQLTimestamp
. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) SystemConverter
<T, Date> The inverse converter.private static final long
For cross-version compatibility.Fields inherited from class org.apache.sis.internal.converter.ClassPair
sourceClass, targetClass
-
Constructor Summary
ConstructorsConstructorDescriptionDateConverter
(Class<T> targetClass) Creates a converter for the given target type. -
Method Summary
Modifier and TypeMethodDescriptionfinal ObjectConverter
<T, Date> inverse()
Returns the inverse converter.Returns the function properties.Methods inherited from class org.apache.sis.internal.converter.SystemConverter
bijective, equals, formatErrorMessage, getSourceClass, getTargetClass, readResolve, unique
Methods inherited from class org.apache.sis.internal.converter.ClassPair
cast, hashCode, parentSource, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.sis.util.ObjectConverter
apply
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
inverse
SystemConverter<T,Date> inverseThe inverse converter. Must be initialized by subclass constructors.
-
-
Constructor Details
-
DateConverter
Creates a converter for the given target type. Subclasses must initializeinverse
.
-
-
Method Details
-
properties
Returns the function properties.- Returns:
- the manners in which source values are mapped to target values. May be an empty set, but never null.
-
inverse
Returns the inverse converter.- Specified by:
inverse
in interfaceObjectConverter<Date,
T> - Overrides:
inverse
in classSystemConverter<Date,
T> - Returns:
- a converter for converting instances of T back to instances of S.
- See Also:
-