Open HosseinYousefi opened 1 year ago
isField
.Overall this is similar to what most java serialization libraries do with getters / setters. (JSON, ORMs & DB drivers). They try to convert getters and setters into fields / columns.
I actually have a locally drafted proposal about better supporting such PoD (plain old data) types, but I think we are too early in the roadmap to discuss that feature.
Big +1 for doing the first two!
That would be similar to what Kotlin to Java interop does: https://kotlinlang.org/docs/java-interop.html#getters-and-setters
Big +1 for doing the first two!
That would be similar to what Kotlin to Java interop does: https://kotlinlang.org/docs/java-interop.html#getters-and-setters
Kotlin is doing some other conversions for operators as well but the documentation is somewhat vague about it: https://kotlinlang.org/docs/java-interop.html#operators
For example list[i]
turns into list.get(i)
, and so on... (Similar to the other proposed conversions in this issue).
T getSomeValue()
that returns a private valueT someValue
with the same type and doesn't get any arguments can be converted to a Dart's getterT get someValue
– potentially only under a config flagvoid setSomeValue(T t)
that gets a value of typeT
and returnsvoid
can be converted into a Dart's setterset someValue(T t)
– potentially only under a config flagget
methods that only get a single argument can be converted tooperator []
– potentially only under a config flagput
methods that only get two arguments can also be converted tooperator []=
. We still probably want to generateput
becauseput
usually returns the value in Java while[]=
returnsvoid
– potentially only under a config flagequals
method can overloadoperator ==
andhashCode
can override the hash code getter.More conversions that can make the code more idiomatic to Dart? Feel free to suggest.