core/core/api/src/commonMain/kotlin/dev/inmo/postssystem/core/content/api/business/content_adapters/text/TextBusinessContentRepoContentAdapter.kt

15 lines
651 B
Kotlin
Raw Normal View History

2020-11-26 10:54:57 +00:00
package dev.inmo.postssystem.core.content.api.business.content_adapters.text
import dev.inmo.micro_utils.repos.*
import dev.inmo.postssystem.core.content.ContentId
import dev.inmo.postssystem.core.content.api.business.BusinessContentRepoContentAdapter
import dev.inmo.postssystem.core.content.api.business.content_adapters.KeyValueBusinessContentRepoAdapter
class TextBusinessContentRepoContentAdapter(
private val keyValueRepo: StandardKeyValueRepo<ContentId, String>
) : BusinessContentRepoContentAdapter by KeyValueBusinessContentRepoAdapter(
"regularText",
keyValueRepo,
{ (it as? TextContent) ?.text },
{ TextContent(it) }
)