By Adam L. Davis

Start development strong apps that benefit from the dynamic scripting services of the Groovy language. This publication covers Groovy basics, similar to fitting Groovy, utilizing Groovy instruments, and dealing with the Groovy improvement equipment (GDK). you are going to additionally research extra complex facets of Groovy, reminiscent of utilizing Groovy layout styles, writing DSLs in Groovy, and making the most of Groovy's practical programming features.

There is extra to Groovy than the middle language, so Learning Groovy covers the prolonged Groovy environment. you will see easy methods to harness Gradle (Groovy's construct system), Grails (Groovy's internet program framework), Spock (Groovy's trying out framework), and Ratpack (Groovy's reactive net library).

What you will learn

  • Groovy basics, together with the GDK or Groovy improvement Kit
  • Advanced Groovy, akin to writing Groovy DSLs
  • Functional programming in Groovy
  • GPars, the integrated concurrency library
  • Gradle, the construct system
  • Grails, the net software framework
  • Spock, the checking out framework
  • Ratpack, the reactive internet library

Who is that this booklet for
Although this publication is meant for people with a Java history, an individual with simple programming talents may gain advantage from it. This e-book is a data-filled, but easy-to-digest travel of the Groovy language and environment.

Show description

Read or Download Learning Groovy PDF

Best compilers books

The Definitive Guide to SugarCRM: Better Business Applications (Books for Professionals by Professionals)

SugarCRM is one in all if no longer the top Open resource CRM answer available to buy at five. five million downloads and growing to be and with approximately 17,000 registered builders and plenty extra clients. this can be the professional, definitive publication written by way of SugarCRM and recommended by way of SugarCRM. additionally, this ebook will be additionally the single SugarCRM developer e-book in an effort to handle the platform comparable good points seeing that SugarCRM five.

Methodologies and Software Engineering for Agent Systems: The Agent-Oriented Software Engineering Handbook

As info applied sciences develop into more and more disbursed and obtainable to greater variety of humans and as advertisement and executive businesses are challenged to scale their functions and providers to bigger industry stocks, whereas lowering expenses, there's call for for software program methodologies and appli- tions to supply the subsequent beneficial properties: Richer program end-to-end performance; aid of human involvement within the layout and deployment of the software program; Flexibility of software program behaviour; and Reuse and composition of current software program purposes and structures in novel or adaptive methods.

Numeric Computation and Statistical Data Analysis on the Java Platform

Numerical computation, wisdom discovery and statistical info research built-in with strong second and 3D images for visualisation are the most important subject matters of this e-book. The Python code examples powered by way of the Java platform can simply be remodeled to different programming languages, akin to Java, Groovy, Ruby and BeanShell.

Additional resources for Learning Groovy

Example text

A Better Switch Groovy’s switch statement is much like Java’s, except that it allows many more case expressions. 30: // Range result = "12 to 30" break case Integer: result = "was integer" break case Number: result = "was number" break default: result = "default" } Meta-Programming In Groovy, you can add methods to classes at runtime, even to core Java libraries. toUpperCase() Static Type-Checking If you add the @TypeChecked annotation to your class, it causes the compiler to enforce compile time type-checking.

Overriding Operators In Groovy you can override operators simply by naming your methods using the English word for the operator. For example, plus for + and minus for -. 36 CHAPTER 7 ■ DSLS Operator Method Name + Plus - Minus * Multiply / Div % Mod ** Power | Or & And ˆ xor << Left shift >> Right shift ++ Next -- Previous All of these methods have one parameter except for next and previous, which have no parameters. For example, let’s create a class called Logic with a Boolean value and define the and and or methods.

Summary In this chapter, you learned about the following Groovy features: • You can provide default method values. transform package. • How regular expressions are built into Groovy. • You should define arrays differently than Java. • How to use unclosed operations when writing a multiline statement. • Groovy uses BigDecimal by default for non-integer numbers. • Groovy truth. • You can use variable keys in the map syntax. 27 PART II Advanced Groovy Beyond the basics, Groovy is a rich tapestry of language features.

Download PDF sample

Rated 4.44 of 5 – based on 24 votes