public abstract class StringCollectionLens<C extends java.util.Collection<java.lang.String>> extends Lens<C> implements Refractor<C>
Lens
which can marshal a
collection of strings to/from a single column in a database row.Constructor and Description |
---|
StringCollectionLens() |
Modifier and Type | Method and Description |
---|---|
StringCollectionLens<C> |
addToBundle(android.os.Bundle bndl,
java.lang.String sKey,
C val)
Adds the collection of strings to a
Bundle as a string array. |
StringCollectionLens<C> |
addToContentValues(android.content.ContentValues vals,
java.lang.String sKey,
C val)
Determines the correct method in
ContentValues to be used to add
the specified value to a set of content values. |
C |
fromBundle(android.os.Bundle bndl,
java.lang.String sKey)
Fetches a collection of strings from a
Bundle as a string array. |
C |
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. |
protected abstract C |
getCollectionInstance()
Implementation classes must provide a concrete override of this method to
generate instances of the collection class which contains the list items.
|
protected abstract java.lang.String |
getDelimiter()
Implementation classes must provide a concrete override of this method to
declare the delimiter that is used/sought between items in the serialized
list.
|
java.lang.String |
getSQLiteDataType()
Defines the SQLite data type to be used when writing a value into the
database.
|
java.lang.String |
toSQLiteString(C 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 |
toStringValue(C asValues)
Serializes the list as a string, using the delimiter provided by
getDelimiter() . |
getSQLiteDefaultString, getSQLiteDefaultValue, getValueFrom
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSQLiteDefaultString, getSQLiteDefaultValue, getValueFrom
protected abstract java.lang.String getDelimiter()
protected abstract C getCollectionInstance()
public java.lang.String toStringValue(C asValues)
getDelimiter()
.asValues
- a collection of string valuespublic java.lang.String getSQLiteDataType()
Refractor
getSQLiteDataType
in interface Refractor<C extends java.util.Collection<java.lang.String>>
public java.lang.String toSQLiteString(C o)
Refractor
WHERE
clause filter.toSQLiteString
in interface Refractor<C extends java.util.Collection<java.lang.String>>
toSQLiteString
in class Lens<C extends java.util.Collection<java.lang.String>>
o
- the Java thing to be convertedpublic StringCollectionLens<C> addToContentValues(android.content.ContentValues vals, java.lang.String sKey, C val)
Refractor
ContentValues
to be used to add
the specified value to a set of content values.addToContentValues
in interface Refractor<C extends java.util.Collection<java.lang.String>>
vals
- the set of content valuessKey
- the content value keyval
- the value to be storedpublic StringCollectionLens<C> addToBundle(android.os.Bundle bndl, java.lang.String sKey, C val)
Bundle
as a string array.
This will always be rendered in the bundle as a string array,
regardless of the algorithm that would marshal the collection to/from a
database as a string serialization.addToBundle
in interface Refractor<C extends java.util.Collection<java.lang.String>>
bndl
- the bundlesKey
- the field's keyval
- the value to be storedpublic C 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<C extends java.util.Collection<java.lang.String>>
crs
- the cursor from which data should be fetchedsKey
- the data column namepublic C fromBundle(android.os.Bundle bndl, java.lang.String sKey)
Bundle
as a string array.
This will always be rendered in the bundle as a string array,
regardless of the algorithm that would marshal the collection to/from a
database as a string serialization.fromBundle
in interface Refractor<C extends java.util.Collection<java.lang.String>>
bndl
- the bundle from which data should be fetchedsKey
- the data column name