I have a Java object. And I have a Kotlin Multi Platform object. How do I convert this Java object to the Kotlin Multi Platform object?
Java Code:
public class JavaRecentItemList extends ObservableBean implements Parcelable {
@SerializedName("TotalRowCount")
int totalRowCount;
}
Kotlin Multi Platform Shared code:
import kotlinx.serialization.Serializable
@Serializable
data class KMMRecentItemList(
val TotalRowCount: Int? = null
)
I have a KMM library that needs a KMMRecentItemList. i.e:
suspend fun foo(itemList: KMMRecentItemList) {
}
You just copy it the straightforward way. Nothing is special about these objects from Kotlin's perspective.
val converted = KMMREcentItemList(javaRecentItemList.totalRowCount)