Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.gawst.asyncdb.source.typed;
 
 import  android.content.ContentValues;
 import  android.database.Cursor;
 import  android.support.annotation.NonNull;
 
Abstract helper org.gawst.asyncdb.DataSource class reading using a android.database.Cursor.

Parameters:
<E> Type of the elements read from the CURSOR
<CURSOR> Wrapper around the raw Cursor read
Author(s):
Created by robUx4 on 11/01/2015.
See also:
TypedContentProviderDataSource
TypedSqliteDataSource
TypedSqliteMapDataSource
public abstract class TypedCursorDataSource<E, INSERT_ID, DATABASE_ID, CURSOR extends Cursor> implements DataSource<E, INSERT_ID>, TypedDatabaseSource<INSERT_ID, DATABASE_ID, CURSOR> {
Constructor.

Parameters:
databaseElementHandler Handler to transform E elements to queries and Cursor to E elements.
	public TypedCursorDataSource(@NonNull TypedDatabaseElementHandler<E, CURSOR> databaseElementHandler) {
		if (databaseElementHandler == null)
			throw new NullPointerException("null TypedDatabaseElementHandler in " + this);
		this. = databaseElementHandler;
	}
	public final boolean update(E itemToUpdate, ContentValues updateValues) {
		return update(updateValues.getItemSelectClause(itemToUpdate), .getItemSelectArgs(itemToUpdate)) != 0;
	}
	public final int delete(E itemToDelete) {
	}
	public final void queryAll(BatchReadingCallback<E> readingCallback) {
		CURSOR c = query(nullnullnullnullnullnullnull);
		if (c != null)
			try {
				if (c.moveToFirst()) {
					readingCallback.startLoadingAllItems(c.getCount());
					do {
						try {
							readingCallback.addItemInMemory(item);
catch (InvalidDbEntry e) {
							readingCallback.removeInvalidEntry(e.getInvalidEntry());
						}
while (c.moveToNext());
				}
finally {
				c.close();
			}
	}
	public boolean deleteInvalidEntry(InvalidEntry invalidEntry) {
		return delete(.getItemSelectClause(null), invalidEntry.getSelectArgs()) != 0;
	}
	protected String getToStringHeader() {
		return "TypedCursor";
	}

See also:
getToStringHeader()
	public final String toString() {
		return "{"+getToStringHeader()+" eltHandler="++'}';
	}
New to GrepCode? Check out our FAQ X