Barodapride Barodapride - 1 year ago 79
Groovy Question

Accessing Groovy properties or methods

I have a simple question. If I have an

) how come I can do
to get the response code? When I'm debugging I don't see this property available in the object. I looked up the API and I don't see the status property available. How is
working? Am I missing a language feature?

Answer Source

The Groovy property is a combination of a private field and getters/setters. Groovy will then generate the getters/setters appropriately.

For example:

class Person {
    String name                             
    int age

Properties are accessed by name and will call the getter or setter transparently. I would recommend read more in the Groovy documentation for field and properties.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download