Created
August 27, 2019 21:22
-
-
Save Rasalexman/e55afb34afae839cc55704f416d7db8e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typealias UserAddressBuilderLambda = () -> UserAddress // 1 | |
class UserAddressBuilder( | |
addressInit: UserAddressBuilder.() -> Unit // 2 | |
) : UserAddressBuilderLambda { | |
init { | |
this.addressInit() // 3 | |
} | |
var userCity: String = "" | |
var userCountry: String = "" | |
override fun invoke(): UserAddress { // 4 | |
return object : UserAddress { | |
override val city: String = userCity | |
override val country: String = userCountry | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment