native icon indicating copy to clipboard operation
native copied to clipboard

Object utility methods

Open mahesh-hegde opened this issue 2 years ago • 1 comments

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 isInstanceOf from JNI.
  • [ ] IsSameObject - should we overload == to call IsSameObject from JNI? (Different ref values can point to same object).

  • [ ] Get class name

    • This is a bit complicated, first we get jclass and 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.

mahesh-hegde avatar Apr 30 '23 03:04 mahesh-hegde

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.

HosseinYousefi avatar May 02 '23 08:05 HosseinYousefi