sdeleuze
01/23/2019, 8:53 AMPersistable
. I would like to avoid having to use Persistable
with data classes which does not seems a good fit, but there is something I am not sure about Kotlin / Java interop. Let's take following code (Persistable
is a Java interface):
public interface Persistable<ID> {
@Nullable
ID getId();
boolean isNew();
}
data class User(
val id: String?,
val firstname: String,
val lastname: String) : Persistable<String?> {
override fun isNew(): Boolean = id.isNullOrBlank()
}