j256 / ormlite-android

ORMLite Android functionality used in conjunction with ormlite-core
http://ormlite.com/
ISC License
1.59k stars 367 forks source link

OrmLiteCursorAdapter return a Typed entity instead a cursor #24

Closed guitcastro closed 9 years ago

guitcastro commented 10 years ago

It´s nice to take more advantage of Generic

efung commented 10 years ago

I, too, have made this extension, but in my own subclass. IMHO, it's arguable whether ORMlite should do this, as it's currently following the behaviour of CursorAdapter which returns the Cursor after moving the position.

guitcastro commented 10 years ago

I guess it´s arguable, but I guess we could create getItemCursor(position) or do the inverse getTypedItem(position) and in this case getItem still returning a Cursor.

But IMHO get the access the model it´s much more frequently and user friend than cursors.

atali commented 10 years ago

I like this feature, when it will available on ormlite ?

VincentJousse commented 10 years ago

+1

j256 commented 9 years ago

Sorry, I just don't get this merge request. It removes a ton of code. Am I understanding it right?

guitcastro commented 9 years ago

@j256 Sorry I am not familiar with github PR.

The only commit related to this PR is this one https://github.com/guitcastro/ormlite-android/commit/3fb3c483525788f71e9639491ebe2647f623d453

The commit that remove a ton of code is related to this issue:

https://github.com/guitcastro/ormlite-android/commit/de028277563ae51d87c563929b17a518484bed75

And the other commit does not make sense for you (only for my fork).

I don´t know why those commits were added to this PR. = /

j256 commented 9 years ago

I've hand merged the one commit but I can't make the permanent without breaking existing code, right? So I used you getTypedItem(...) name instead. Hope this is adequate.

j256 commented 9 years ago

See: https://github.com/j256/ormlite-android/commit/fa55a367f3acb7418d7ad62db39f874d1eff3ead

VincentJousse commented 9 years ago

What code would this break ? It should keep its name (getItem) as it greatly overides the extended class (CursorAdapter) method !

j256 commented 9 years ago

But it's returning a completely different object. Anyone using that method would have code that wouldn't compile, right?

VincentJousse commented 9 years ago

My humblest apologies, you're right, I misread the CursorAdapter method return type.