Skip to content

Instantly share code, notes, and snippets.

@jaspersprengers jaspersprengers/entityconverter.kt Secret

Last active Feb 4, 2018
What would you like to do?
interface Converter<in E : HasDTO<out D>, out D : DTO> : (E) -> D
class PreferenceToDto : Converter<Preference, PreferenceDTO> {
override fun invoke(preference: Preference): PreferenceDTO = TODO()
lateinit var converter: PreferenceToDto
//invocation with explicit method name
val dto = converter.convert(someEntity)
//the shorthand version
val dto2 = converter(someEntity)
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.