11.3 Dynamically Accessing Objects

Programming Groovy 2 — by Venkat Subramaniam (97 / 152)

👈 11.2 Querying Methods and Properties | TOC | Chapter 12 Intercepting Methods Using MOP 👉

We’ve looked at ways to query for methods and properties, and at ways to invoke them dynamically. There are other convenient ways to access properties and call methods in Groovy. We will look at them now using an instance of ​String​ as an example. Suppose we get the names of properties and methods as input at runtime and want to access these dynamically. Here…

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
The Pragmatic Programmers

The Pragmatic Programmers

We create timely, practical books and learning resources on classic and cutting-edge topics to help you practice your craft and accelerate your career.