APPENDIX I MORE ON CLASSES

This appendix considers a number of aspects of classes that we chose to defer when first introducing them in Chapter 12. We consider the visibility of properties and their getter and setter methods and we demonstrate how certain method names are reserved to act as method definitions for the standard operators. We also discuss the support offered by Groovy for navigating through a network of objects.

I.1 PROPERTIES AND VISIBILITY

We have seen how properties can significantly reduce the size of code when defining a class. Groovy seeks to unify the notion of instance fields and methods through the use of properties. Further, we also know that (public) properties in a class give rise to public getters and setters automatically ...

Get Groovy Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.