O'Reilly logo

Kotlin in Action by Svetlana Isakova, Dmitry Jemerov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10. Annotations and reflection

This chapter covers

  • Applying and defining annotations
  • Using reflection to introspect classes at runtime
  • A real example of a Kotlin project

Up to this point, you’ve seen many features for working with classes and functions, but they all require you to specify the exact names of classes and functions you’re using as part of the program source code. In order to call a function, you need to know the class in which it was defined, as well as its name and parameter types. Annotations and reflection give you the power to go beyond that and to write code that deals with arbitrary classes that aren’t known in advance. You can use annotations to assign library-specific semantics to those classes; and reflection ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required