https://kotlinlang.org logo
Title
o

orafaaraujo

08/03/2018, 7:56 PM
Hi, everyone Is there a way to ignore a property on
toString()
when using
data class
? Something like an annotation...
or only overriding it?
a

Andreas Sinz

08/03/2018, 7:57 PM
yes, you need to override it
o

orafaaraujo

08/03/2018, 7:58 PM
okay, thx
a

adam-mcneilly

08/03/2018, 8:04 PM
You could define it outside of the constructor and inside the class itself, but that means it will be excluded from equals/hash code as well. Don't know your use case, might not be okay, but wanted you to know.
o

orafaaraujo

08/03/2018, 8:10 PM
yeap, it's a good option as well I personally think it's even painless than override toString
but depends on the scenario etc thanks!
👍 1