-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add RealmCursor #53
add RealmCursor #53
Conversation
@@ -0,0 +1,601 @@ | |||
package io.realm; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing license header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Hi @larsgrefer A few general comments:
If you want to move forward with this PR there is a number of things that needs to be discussed/clarified first:
First steps should as a minimum be porting all the unit tests over. /cc @realm/java |
*/ | ||
@Override | ||
public int getColumnIndexOrThrow(@NonNull String columnName) throws IllegalArgumentException { | ||
if (data == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use curly brackets
I've seen this too late
What kind of problems do you mean?
👍
I think this should not be supported.
I will do this. |
if (aLong >= Integer.MAX_VALUE) | ||
return Integer.MAX_VALUE; | ||
return (int) aLong; | ||
if (aLong > Integer.MIN_VALUE && aLong < Integer.MAX_VALUE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it acceptable that if the value is out of range, nothing (undefined) is returned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this code path will throw with canNotConvert()
since there is no break
.
Edit> You are right. This can be re-written for clarification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. But do we wish the same message for the two cases: out of range, and wrong type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's good point. I think this is updated and you'd perhaps want to comment on new commits.
|
||
import io.realm.entity.AllJavaTypes; | ||
|
||
public class RealmCursorTest extends AndroidTestCase { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these should be converted to JUnit4 since that is what we are writing all new tests with. This also include removing the test
prefix. See https://github.com/realm/realm-java/blob/master/CONTRIBUTING.md#unit-tests
Our original implementation also had the concept of setting an "_id" column, which is required for a number of Android framework classes. I would like for this functionality to be present as well. Unit tests are still failing btw: |
The tests are not running in Looper-Threads so they can't add ChangeListeners |
Testing failed with below information
|
@beeender same reason as in #53 (comment) to solve this, I would need these classes from realm-java: Shall I copy the classes or do you want to build a new artifact which contains them? |
@larsgrefer Copying the rules is fine with me. |
fix #6
is it correct to open pull requests against the
master
branch, or should I PR against thereleases
branch instead?