ObjectBox Mobile Database now offers full support for Kotlin. We are happy to announce that with ObjectBox 0.9.13, we deliver one of the most asked for ObjectBox features: modelling entities with Kotlin classes (including data classes).
Being huge Kotlin fans ourselves, we are quite happy about this release – especially after Google announced official Kotlin support for Android. If you did not try Kotlin yet, you really should. It is a great improvement over Java.
Special thanks to our community on Github who helped us with feedback on prior release candidates for the Kotlin feature. You’re awesome! Technically, Kotlin support was a bigger step than one might expect. Indeed, we had to completely replace some build components that operated exclusively on Java source code. The new build tools are based on standard annotation processing and a class transformer. This works with a variety of JVM based languages.
Using Kotlin for entities is simple and saves you a lot of code:
1 2 3 4 5 | @Entity data class Person( @Id var id: Long = 0, var name: String ) |
Going forward, we will replace the Java-based Gradle plugin with the new build tools in a future release. Consequently, at that point we will drop the in-place Java source generation in entity classes.
To learn more about Kotlin support and the new build tools, check our Kotlin documentation page.
While Kotlin is the “big feature” of 0.9.13, this version also comes with important fixes and other helpful improvements. Accordingly, check the change log for details.
Please let us know what you think about ObjectBox by filling out our questionnaire.