public abstract class TimeMapper extends java.lang.Object implements DomainMapper
A java (IEEE 754) double has 52+1 bits of precision, which I make 52*ln(2)/ln(10)=15.65 decimal places, and a year contains 3.15e7 seconds, which gives you the following precisions:
Modifier and Type | Field and Description |
---|---|
static TimeMapper |
DECIMAL_YEAR
Mapper for numeric values in decimal year (since 0 AD).
|
static TimeMapper |
ISO_8601
Mapper for ISO-8601 strings.
|
static TimeMapper |
JD
Mapper for numeric values in Julian Day.
|
static TimeMapper |
MJD
Mapper for numeric values in Modified Julian Date.
|
static java.lang.String |
TARGET_NAME
Returns target domain name ("Time").
|
static TimeMapper |
UNIX_SECONDS
Mapper for numeric values (already) in unix seconds.
|
Modifier | Constructor and Description |
---|---|
protected |
TimeMapper(java.lang.Class<?> sourceClass,
java.lang.String sourceName,
java.lang.String sourceDescription)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Class<?> |
getSourceClass()
Returns the type of values from which this mapper instance can
convert.
|
java.lang.String |
getSourceDescription()
Returns a description of the type of source values which this mapper
can convert from.
|
java.lang.String |
getSourceName()
Returns a short name for the type of source values which this mapper
can convert from.
|
java.lang.String |
getTargetName()
Returns
TARGET_NAME . |
static TimeMapper[] |
getTimeMappers()
Returns a selection of time mapper instances.
|
abstract double |
toUnixSeconds(java.lang.Object sourceValue)
Maps a source value to time in seconds since the Unix epoch.
|
public static final java.lang.String TARGET_NAME
public static final TimeMapper DECIMAL_YEAR
public static final TimeMapper MJD
public static final TimeMapper JD
public static final TimeMapper UNIX_SECONDS
public static final TimeMapper ISO_8601
protected TimeMapper(java.lang.Class<?> sourceClass, java.lang.String sourceName, java.lang.String sourceDescription)
sourceClass
- source classsourceName
- source type namesourceDescription
- source type descriptionpublic final java.lang.String getTargetName()
TARGET_NAME
.getTargetName
in interface DomainMapper
public java.lang.Class<?> getSourceClass()
DomainMapper
getSourceClass
in interface DomainMapper
public java.lang.String getSourceName()
DomainMapper
getSourceName
in interface DomainMapper
public java.lang.String getSourceDescription()
DomainMapper
getSourceDescription
in interface DomainMapper
public abstract double toUnixSeconds(java.lang.Object sourceValue)
sourceValue
- value in source domainpublic static TimeMapper[] getTimeMappers()