Created
June 18, 2020 15:29
-
-
Save PoisonousJohn/de5842d3ce3b035757544513facb5270 to your computer and use it in GitHub Desktop.
Kotlin data class, Check fields equality by reflection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fields = originalInvoice::class.memberProperties | |
var string = "" | |
for (field in fields) { | |
if (field.getter.call(originalInvoice) != field.getter.call(this)) string += "${field.name}\n" | |
} | |
string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment