July 2018
Intermediate to advanced
242 pages
8h 6m
English
Let's assume we have the Dialog class specified in some external dependency with an interface provided as follows:
class Dialog { lateinit var title: String lateinit var message: String lateinit var messageColor: String lateinit var image: ByteArray fun show() = println("Dialog...\n$this") override fun toString() = "Title: $title \nImage: $image \nMessage: $message"}
The Dialog class exposes the following properties—title: String, message: String, messageColor: String, and image: File. We are going to implement a DialogBuilder class, which allows us to instantiate the Dialog class using the builder pattern. As the result, we would like to create a mechanism that allows us to instantiate the Dialog type using a DSL-like syntax ...
Read now
Unlock full access