Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
package org.craftsrecords.talkadvisor.infra.resources
import org.craftsrecords.talkadvisor.recommendation.preferences.Preferences as DomainPreferences
import org.craftsrecords.talkadvisor.recommendation.preferences.Topic as DomainTopic
import org.craftsrecords.talkadvisor.recommendation.talk.TalkFormat as DomainTalkFormat
data class Preferences(val topics: List<Topic>, val talksFormats: List<String>) {
fun toDomainObject(): DomainPreferences {
return DomainPreferences(topics.toDomainObjects(), talksFormats.toDomainTalkFormats())
}
}
package org.craftsrecords.talkadvisor.infra.resources
import org.craftsrecords.talkadvisor.recommendation.preferences.Topic as DomainTopic
class Topic(val name: String) {
fun toDomainObject(): DomainTopic {
return DomainTopic(this.name)
}
}
fun Iterable<Topic>.toDomainObjects(): Set<DomainTopic> {
return this.map(Topic::toDomainObject).toSet()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.