我有下一个kotlin对象调用Podcast:
data class PodCast(val id: String, val type: String, val items: List<Item>, val header: Header, val cellType:String? = "")
data class Item(val type: String, val parentId: String, val parentType: String, val id: String, val action: Action, val isNew: Boolean)
data class Header(val color: String, val label: String)
data class Action(val type: String, val url: String)
我有一个Presenter类,它构建Podcast对象并返回响应,如下所示:
interface PodCastCardPresenterRepresentable {
fun present(context: PodCastPresenterContext): PodCast
}
@Component
class PodCastPresenter : PodCastCardPresenterRepresentable {
override fun present(context: PodCastPresenterContext): PodCast {
val item = Item("podcasts", "my-podcasts-collection", "Podcasts Collection", "26282086",
Action("internalLink", "sportscenter://x-callback-url/showPlayerBrowse?uid=s:20~l:23~g:80"), true)
val header = Header("A5A6A7", "My Podcasts")
return PodCast("my-podcasts-collection", "Podcasts Collection", arrayListOf(item), header)
}
}
问题是我必须调用此方法,因为常规类由于某种业务限制而存在,问题在于常规类似乎无法识别kotlin的数据类,因此我必须将其转换为常规类地图,以便能够继续该过程。
有什么主意吗?
谢谢。