Quantcast Groovy - Programmer's Wiki - a Wikia wiki
Recent changes Random page
GAMING
Technology
 
Gaming
Entertainment
Science Fiction
Biggest wikis
Hobbies
Music
See more...

Groovy

From Programmer's Wiki

Jump to: navigation, search

Groovy is a scripting language built on the Java platform. Groovy code can be run either as an interpreted script or compiled into Java bytecode, which can then be run anywhere that Java can. Because Groovy can use java syntax and can use the same libraries it is very easy for Java Programmers to Learn.


Contents

[edit] Features

[edit] Closures

Closures are similar to method calls. The biggest difference is that they can be assigned to variables so you can change what a Closure does at run time.

Closure example

def double = { it * 2 }

Function example

def double(n) { n * 2 }

closures come with a default variable it (short for item) that is used when iterating over collections.

[edit] Builders

Builders are a way of packaging Groovy code as a Domain Specific Language. There are a number of ways to create a builder. The easiest way seems to be to extend BuilderSupport.

[edit] SwingBuilder

SwingBuilder is a builder that helps create Swing based guis. Building swing guis this way is far easier than the normal Java method.

[edit] AntBuilder

Builder that creates Ant scripts.

[edit] Notable Applications

Grails is a web development application which is similar to Ruby on Rails.

[edit] Groovy Examples

[edit] External Resources

Rate this article:
Share this article: