develop with


Kotlin annotation usage and creation of annotation classes

Creating an annotation in Kotlin

To create an annotation in Kotlin prefix the class definition with annotation and annotate the class with the desired @Target and @Retention scope.


annotation class IgnoreNull

The constructor of the annotation are the properties that can be set while annotating the desired target. For instance:

annotation class IgnoreNull(val scope:String)

comments powered by Disqus

Want to see a topic covered? create a suggestion

Get more developer references and books in the developwith store.