July 2018
Intermediate to advanced
242 pages
8h 6m
English
Similar to the interface delegation, the class property delegation is achieved using the by keyword in the following manner:
class MyClass { var property: String by MyDelegate}
The object which is delegated to should implement one of the following interfaces—ReadWriteProperty or ReadOnlyProperty from the kotlin.properties package. Those interfaces expose the getValue() and setValue() functions, which provide values for the property.
We are going to use the Gson library to convert objects into their JSON format representation. It's a widely used Java library for working with JSON-formatted objects. You can learn more about the library on its GitHub site (https://github.com/google/gson). If you're using the Gradle build tool, ...
Read now
Unlock full access