Class DateConverter<T>
java.lang.Object
org.apache.sis.internal.converter.ClassPair<S,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 classConverter fromLongtoDate.static final classConverter fromDatetoLong.static final classFromDateto SQLDate.static final classFromDateto SQLTimestamp. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) SystemConverter<T,Date> The inverse converter.private static final longFor 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, uniqueMethods inherited from class org.apache.sis.internal.converter.ClassPair
cast, hashCode, parentSource, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
inversein interfaceObjectConverter<Date,T> - Overrides:
inversein classSystemConverter<Date,T> - Returns:
- a converter for converting instances of T back to instances of S.
- See Also:
-