Let’s say we have a serializable data class with a lazy delegate.
data class Person(val firstName : String, val lastName : String) : Serializable {
val fullName : String by lazy { "$firstName $lastName" }
}
How could one tell the java serialization framework not to serialize the fullName? The @Transient annotation must be placed on the field, but regardless where I tried to add the annotation, it always created compile error.
yes that is clear, it was not a perfect example, in my case the calculation is really more expensive than a string concatenation and that is what I am trying to avoid