Chapter 3. Using Groovy Language Features

In this chapter, we will cover:

  • Searching strings with regular expressions
  • Writing less verbose Java Beans with Groovy Beans
  • Inheriting constructors in Groovy classes
  • Adding the cloning functionality to Groovy Beans
  • Defining code as data in Groovy
  • Defining data structures as code in Groovy
  • Implementing multiple inheritance in Groovy
  • Adding a functionality to the existing Java/Groovy classes
  • Defining type-checking rules for dynamic code
  • Adding automatic logging to Groovy classes

Introduction

This chapter is all about what makes Groovy a very productive and fun programming language.

Groovy popularity builds on certain features of the language that are simply done right, such as closures or builders and are particularly appealing for Java programmers.

The recipes found in this chapter show the different facets of the Groovy language that allows to write a more terse, readable, and less ceremonious code in comparison to Java.

In this chapter, the reader will find—among others—recipes about the incredibly productive Groovy-enhanced collection framework, closures, builders, and the fancy annotations that makes code shorter and to the point.

For the most geeks among the readers, we have also added some recipes about advanced language features such as regular expressions, mixins, and extension methods.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.142.166