public interface DBTimeTranslator
java.lang.String
arguments.
The first argument is the native database timestamp/date/time value.
All implementations MUST be able to corectly translate ODBC canoncial
formats for timestamp yyyy-mm-dd hh:mm:ss.fffffffff
,
date yyyy-mm-dd
and time hh:mm:ss
in addition to native database formats for these types.
This is easily accomplished by using the
java.sql.Timestamp.valueOf(String)
,
java.sql.Date.valueOf(String)
and
java.sql.Time.valueOf(String)
methods,
respectively.
The second argument is the name of the Java class this instance represents
(i.e., "java.sql.Timestamp
",
"java.sql.Date
", or "java.sql.Time
"),
"java.sql.Timestamp
" being the default. The unqualified
class name can also be used (e.g., "timestamp", "date" or "time"),
case-insensitive.
The third argument is reserved for future use.
The fourth argument is the output format, either "1
" (integer) or
"2
" (string), the default being "1
" (integer).
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_DATE
java.sql.Date |
static java.lang.String |
CLASS_TIME
java.sql.Time |
static java.lang.String |
CLASS_TIMESTAMP
java.sql.Timestamp |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDSTime()
Returns this timestamp/date/time value in the directory canonical
string format (e.g.
CCYYMMDDHHMMSSNNNNNNNNN ,
CCYYMMDD or HHMMSS ) or in the
32-bit integer string format (e.g. "1013368206"),
if translation was successful. |
java.lang.String |
getErrorMessage()
Returns the first parse error message, if any.
|
java.util.List |
getExceptions()
Returns any exceptions generated while parsing.
|
boolean |
parseError()
Indicates whether an error occurred parsing this timestamp/date/time
value.
|
boolean |
precisionLost()
Indicates whether precision was lost translating this timestamp
value to the specified directory format.
|
void |
setDSTime(java.lang.String nativeTime)
Translates a database-native timestamp/date/time value into an
equivalent directory format as per the arguments passed to the constructor.
|
static final java.lang.String CLASS_TIMESTAMP
java.sql.Timestamp
static final java.lang.String CLASS_DATE
java.sql.Date
static final java.lang.String CLASS_TIME
java.sql.Time
java.lang.String getDSTime()
CCYYMMDDHHMMSSNNNNNNNNN
,
CCYYMMDD
or HHMMSS
) or in the
32-bit integer string format (e.g. "1013368206"),
if translation was successful.null
void setDSTime(java.lang.String nativeTime) throws java.text.ParseException, java.lang.IllegalArgumentException
nativeTime
- a database-native timestamp, date, or time value;
may be null
java.text.ParseException
java.lang.IllegalArgumentException
boolean parseError()
true
if there was a parse error;
false
otherwisejava.lang.String getErrorMessage()
null
java.util.List getExceptions()
Exception
s with length > 0 if exceptions were generated;
Collections.EMPTY_LIST
otherwise.true
if there was a parse error;
false
otherwise; never returns null
boolean precisionLost()
true
if precision was lost;
false
otherwise