public interface Refractor<T>
Refractor
implementations and register them
in their
SQLiteHouse
descendants, after initialization but before opening a connection.
The package name is a reference to the Fresnel lens of a lighthouse; a set of
implementation classes metaphorically define the rings of a Fresnel lens
through which the data is refracted.Lens
Modifier and Type | Method and Description |
---|---|
Refractor<T> |
addToBundle(android.os.Bundle bndl,
java.lang.String sKey,
T val)
Determines the correct method in
Bundle to be used to add the
specified value to an existing bundle. |
Refractor<T> |
addToContentValues(android.content.ContentValues vals,
java.lang.String sKey,
T val)
Determines the correct method in
ContentValues to be used to add
the specified value to a set of content values. |
T |
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. |
T |
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.lang.String |
getSQLiteDefaultString()
Returns a string representation of the column type's default value, for
use in an SQLite statement.
|
T |
getSQLiteDefaultValue()
Returns a reasonable non-null default value for a column of this
data type in SQLite, particularly for cases in which the value
cannot be null.
|
T |
getValueFrom(SQLightable o,
java.lang.reflect.Field fld)
Gets the value of a field which would be appropriate for this refractor.
|
java.lang.String |
toSQLiteString(T o)
Converts a Java thing's value into a string to be used in a SQLite query,
for example, in a
WHERE clause filter. |
java.lang.String getSQLiteDataType()
T getSQLiteDefaultValue()
0
for integer types,
an empty string for string types, false
for Boolean types, etc.java.lang.String toSQLiteString(T o)
WHERE
clause filter.o
- the Java thing to be convertedjava.lang.String getSQLiteDefaultString()
Lens
abstract class provides a
canonical implementation of this method:
return this.toSQLiteString( this.getSQLiteDefaultValue() ) ;
T getValueFrom(SQLightable o, java.lang.reflect.Field fld) throws java.lang.IllegalAccessException
o
- the object instance from which the value will be extractedfld
- the field from which the value will be extractedjava.lang.IllegalAccessException
Refractor<T> addToContentValues(android.content.ContentValues vals, java.lang.String sKey, T val)
ContentValues
to be used to add
the specified value to a set of content values.vals
- the set of content valuessKey
- the content value keyval
- the value to be storedRefractor<T> addToBundle(android.os.Bundle bndl, java.lang.String sKey, T val)
Bundle
to be used to add the
specified value to an existing bundle.bndl
- the bundlesKey
- the field's keyval
- the value to be storedT fromCursor(android.database.Cursor crs, java.lang.String sKey)
Cursor
to be used to fetch the
specified column, then returns that value.crs
- the cursor from which data should be fetchedsKey
- the data column nameT fromBundle(android.os.Bundle bndl, java.lang.String sKey)
Bundle
to be used to fetch the
specified column, then returns that value.bndl
- the bundle from which data should be fetchedsKey
- the data column name