Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@beyondxscratch
Last active August 13, 2020 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beyondxscratch/49ecc5cf295c88833c316052008f49cb to your computer and use it in GitHub Desktop.
Save beyondxscratch/49ecc5cf295c88833c316052008f49cb to your computer and use it in GitHub Desktop.
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