native
native copied to clipboard
Object utility methods
JNI API provides few useful methods related to class and objects equality. It would be nice to have higher-level wrappers for them working on JObject subclasses.
-
[x] #1033
- Alternative:
obj.isInstanceOf(ClassName.type) - Implementation: use
isInstanceOffrom JNI.
- Alternative:
-
[ ]
IsSameObject- should we overload==to callIsSameObjectfrom JNI? (Different ref values can point to same object). -
[ ] Get class name
- This is a bit complicated, first we get
jclassand call some methods on it: https://stackoverflow.com/questions/9265457/class-name-from-jclass-in-jni - Alternatively we can rely on dart-lang/native#711 and include
Class<T>type.
- This is a bit complicated, first we get
IsSameObject - should we overload == to call IsSameObject from JNI? (Different ref values can point to same object).
isSameObject can be its own method. In the branch I'm currently working on, I decided to overload == to call equals as I think this is idiomatic in Dart.
obj.isInstanceOf(ClassName.type)
I like this.