public abstract class Lens<T> extends java.lang.Object implements Refractor<T>
Refractor
.
Custom implementations of Refractor
may choose to extend this class
or not; all internal code within the library refers to the interface, not the
abstract class.Constructor and Description |
---|
Lens() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getSQLiteDefaultString()
This is the simplest and canonical implementation of the method specified
by
Refractor . |
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)
This implementation simply uses
Field.get(java.lang.Object) and tries to cast it to
the lens's template parameter type. |
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. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addToBundle, addToContentValues, fromBundle, fromCursor, getSQLiteDataType
public T getSQLiteDefaultValue()
Refractor
0
for integer types,
an empty string for string types, false
for Boolean types, etc.getSQLiteDefaultValue
in interface Refractor<T>
null
public java.lang.String toSQLiteString(T o)
Refractor
WHERE
clause filter.toSQLiteString
in interface Refractor<T>
o
- the Java thing to be convertedpublic java.lang.String getSQLiteDefaultString()
Refractor
.getSQLiteDefaultString
in interface Refractor<T>
public T getValueFrom(SQLightable o, java.lang.reflect.Field fld) throws java.lang.IllegalAccessException
Field.get(java.lang.Object)
and tries to cast it to
the lens's template parameter type. Actual implementation classes should
override this method if the data type is a primitive.getValueFrom
in interface Refractor<T>
o
- the object instance from which the value will be extractedfld
- the field from which the value will be extractedjava.lang.IllegalAccessException