droitatedDB/src/main/java/org/droitateddb/CursorUtil.java
@SuppressWarnings("unchecked")
	public static <T> ObjectCursor<T> getObjectCursor(final Cursor cursor) {
		if (cursor == null) {
			throw new NullPointerException("The given cursor is null");
		}
		if (!(cursor instanceof CursorWrapper)) {
			throw new IllegalArgumentException(
					"The given cursor is not of type " + CursorWrapper.class.getCanonicalName() + ". It has type " + cursor.getClass().getCanonicalName() +
							". Was it queried with a ContentResolver?");
		}

		CursorWrapper wrapper = (CursorWrapper) cursor;
		Cursor wrappedCursor = wrapper.getWrappedCursor();

		if (!(wrappedCursor instanceof ObjectCursor)) {
			throw new IllegalStateException(
					"The wrapped cursor of the given CursorWrapper is not of type " + ObjectCursor.class.getCanonicalName() + ". It has type " +
							wrappedCursor.getClass().getCanonicalName() +
							". Was it queried over a ContentResolver from BaseContentProvider derived ContentProvider?");
		}
		return (ObjectCursor<T>) wrappedCursor;
	}
@SuppressWarnings("unchecked")
	public static <T> ObjectCursor<T> getObjectCursor(final Cursor cursor) {
		if (cursor == null) {
			throw new NullPointerException("The given cursor is null");
		}
		if (!(cursor instanceof CursorWrapper)) {
			throw new IllegalArgumentException(
					"The given cursor is not of type " + CursorWrapper.class.getCanonicalName() + ". It has type " + cursor.getClass().getCanonicalName() +
							". Was it queried with a ContentResolver?");
		}

		CursorWrapper wrapper = (CursorWrapper) cursor;
		Cursor wrappedCursor = wrapper.getWrappedCursor();

		if (!(wrappedCursor instanceof ObjectCursor)) {
			throw new IllegalStateException(
					"The wrapped cursor of the given CursorWrapper is not of type " + ObjectCursor.class.getCanonicalName() + ". It has type " +
							wrappedCursor.getClass().getCanonicalName() +
							". Was it queried over a ContentResolver from BaseContentProvider derived ContentProvider?");
		}
		return (ObjectCursor<T>) wrappedCursor;
	}
@ SuppressWarnings ( "unchecked" ) public static < T > ObjectCursor < T > getObjectCursor ( final Cursor cursor ) { if ( cursor == null ) { throw new NullPointerException ( "The given cursor is null" ) ; } if ( ! ( cursor instanceof CursorWrapper ) ) { throw new IllegalArgumentException ( "The given cursor is not of type " + CursorWrapper . class . getCanonicalName ( ) + ". It has type " + cursor . getClass ( ) . getCanonicalName ( ) + ". Was it queried with a ContentResolver?" ) ; } CursorWrapper wrapper = ( CursorWrapper ) cursor ; Cursor wrappedCursor = wrapper . getWrappedCursor ( ) ; if ( ! ( wrappedCursor instanceof ObjectCursor ) ) { throw new IllegalStateException ( "The wrapped cursor of the given CursorWrapper is not of type " + ObjectCursor . class . getCanonicalName ( ) + ". It has type " + wrappedCursor . getClass ( ) . getCanonicalName ( ) + ". Was it queried over a ContentResolver from BaseContentProvider derived ContentProvider?" ) ; } return ( ObjectCursor < T > ) wrappedCursor ; }
Convert a standard Android {@link Cursor} into a {@link org.droitateddb.cursor.ObjectCursor}.<br>
This is only possible for {@link Cursor}s that where queried over a {@link ContentResolver} from a
{@link ContentProvider} derived by {@link BaseContentProvider}.

@param <T>    Entity class represented within the Cursor
@param cursor Android {@link Cursor}
@return The {@link org.droitateddb.cursor.ObjectCursor} representation of the given Android {@link Cursor}
@throws NullPointerException     When the given cursor is null
@throws IllegalArgumentException When the given cursor is not of the type {@link CursorWrapper}, which will be returned by a
{@link ContentResolver}
@throws IllegalStateException    When the wrapped cursor within the given cursor is not of type {@link org.droitateddb.cursor.ObjectCursor}. This indicates
that the given cursor was not queried from a derivation {@link BaseContentProvider}
Convert a standard Android { @link Cursor } into a { @link org . droitateddb . cursor . ObjectCursor } . <br > This is only possible for { @link Cursor } s that where queried over a { @link ContentResolver } from a { @link ContentProvider } derived by { @link BaseContentProvider } .