public class DateLens extends Lens<java.util.Date> implements Refractor<java.util.Date>
Date
objects.
The lens converts all dates into integer GMT timestamps for storage in the
DB, then recreates the Date
objects upon retrieval. This is because
integer timestamps are more reliably stored and are absolute (no fretting
about timezones).
SQLDateLens
Constructor and Description |
---|
DateLens() |
Modifier and Type | Method and Description |
---|---|
DateLens |
addToBundle(android.os.Bundle bndl,
java.lang.String sKey,
java.util.Date val)
Determines the correct method in
Bundle to be used to add the
specified value to an existing bundle. |
DateLens |
addToContentValues(android.content.ContentValues vals,
java.lang.String sKey,
java.util.Date val)
Determines the correct method in
ContentValues to be used to add
the specified value to a set of content values. |
java.util.Date |
fromBundle(android.os.Bundle bndl,
java.lang.String sKey)
Determines the correct method in
Bundle to be used to fetch the
specified column, then returns that value. |
java.util.Date |
fromCursor(android.database.Cursor crs,
java.lang.String sKey)
Determines the correct method in
Cursor to be used to fetch the
specified column, then returns that value. |
java.lang.String |
getSQLiteDataType()
Defines the SQLite data type to be used when writing a value into the
database.
|
java.util.Date |
getSQLiteDefaultValue()
When a date cannot be null, this class provides a default value at the
start of the epoch.
|
java.lang.String |
toSQLiteString(java.util.Date o)
Converts a Java thing's value into a string to be used in a SQLite query,
for example, in a
WHERE clause filter. |
getSQLiteDefaultString, getValueFrom
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSQLiteDefaultString, getValueFrom
public java.lang.String getSQLiteDataType()
Refractor
getSQLiteDataType
in interface Refractor<java.util.Date>
public java.util.Date getSQLiteDefaultValue()
getSQLiteDefaultValue
in interface Refractor<java.util.Date>
getSQLiteDefaultValue
in class Lens<java.util.Date>
Date
initialized at epoch time zeropublic java.lang.String toSQLiteString(java.util.Date o)
Refractor
WHERE
clause filter.toSQLiteString
in interface Refractor<java.util.Date>
toSQLiteString
in class Lens<java.util.Date>
o
- the Java thing to be convertedpublic DateLens addToContentValues(android.content.ContentValues vals, java.lang.String sKey, java.util.Date val)
Refractor
ContentValues
to be used to add
the specified value to a set of content values.addToContentValues
in interface Refractor<java.util.Date>
vals
- the set of content valuessKey
- the content value keyval
- the value to be storedpublic DateLens addToBundle(android.os.Bundle bndl, java.lang.String sKey, java.util.Date val)
Refractor
Bundle
to be used to add the
specified value to an existing bundle.addToBundle
in interface Refractor<java.util.Date>
bndl
- the bundlesKey
- the field's keyval
- the value to be storedpublic java.util.Date fromCursor(android.database.Cursor crs, java.lang.String sKey)
Refractor
Cursor
to be used to fetch the
specified column, then returns that value.fromCursor
in interface Refractor<java.util.Date>
crs
- the cursor from which data should be fetchedsKey
- the data column namepublic java.util.Date fromBundle(android.os.Bundle bndl, java.lang.String sKey)
Refractor
Bundle
to be used to fetch the
specified column, then returns that value.fromBundle
in interface Refractor<java.util.Date>
bndl
- the bundle from which data should be fetchedsKey
- the data column name