Apache Groovy

Table of Contents

Apache groovy considered being an object oriented programming language. This is used for the java platform. It is static as well as dynamic language. This Groovy has characteristics similar to python, Ruby, perl and smalltalk. This groovy will be used for programming language and scripting language for the java platform.

Groovy is having many features like DSL support, closures and also dynamic typing. Like all other programming language, groovy cannot replacement for java. The source code of groovy will not be a replacement for java. The source code of groovy complies in java Bytecode, so that will be run on any platform where JRE is installed.

Apache Groovy has following features

  1. It has support for both static and dynamic typing
  2. It has support for operator overloading
  3. It is native syntax for lists and associative arrays.
  4. It is native support for regular expressions
  5. It has native support for various markup language such as  XML andHTML.
  6. Groovy is very simple for Java developers. Java and Groovy are similar
  7. We can extend Java libraries.
  8. Groovy also extends the java.lang.object.
Apache Groovy

Why Apache Groovy is used for?

Apache groovy, is robust typed and dynamic language, with static-typing and static compilation capabilities java platforms has goal at improving developer productivity. It combines smoothly with any java program and in no time delivers to our application powerful features, including scripting capabilities.

  1. Flat learning curve-it is concise readable and expressive syntax and also easy to learn for java developers.
  2. It has good integration with Java- Integrates and interoperates well with java and any third party libraries.
  3. It is vibrant and very rich ecosystem-webdevelopment, reactive applications, concurrency/asynchronous/parallelism library, test framework build tools, code analysis GUI building.
  4. Powerful features-There are closures,constructors, runtime and compile time meta programming and  and also functional programming languages exists.
  5. Domain specific language-
  6. Scripting and testing glue-There is a writing maintainable tests all entire our build and automation tasks.

How to install Groovy

step 1 –Ensure that you have installed java .

Step 2- we should type  http://groovy-lang.org/download.html  and click installer.

Apache Groovy

step 3-Launch the downloaded installer. Select the language and click Ok.

Apache Groovy

step 4-Launch the welcome screen,click Next.

Apache Groovy

Step 5-Agree the licence terms.

step 6-select the components we want to install click next.

Apache Groovy

Step 7-select installation directory and click next.

Apache Groovy

step 8- choose the  Start Menu Folder and click Next.

Apache Groovy

Step 9-When installation is done click next.

Apache Groovy

step 10-Click next and  select start menu.

Apache Groovy

Range

A range can be a shorthand for mainly telling a sequence of values.A range is denoted by the first and last values in sequence and Range will be inclusive or may be exclusive.A inclusive range will include all the values from the first to the last while an exclusive range includes all the values except the last.There are some examples of range literals

1…10-An example of an inclusive range

1….<10-An example of an exclusive range

‘a’….’x’-Ranges that can consists of characters

10….1-Ranges can also be in a descending order.

There are many methods

1. Contains- It will check if a range has specific values.

2. Get

It returns the element at the specified position in this range.

3.getForm

It get the lower value of range

4.Goto

It will get the upper value of this range

5. isReverse

Is this a reverse range iterating backwards.

6.size

Returns the number of elements in this range.

7.subList

Returns a view of the portion of this range between the specified fromindex inclusive,andtolindex,exclusive.

Traits

Traits are the structural construct of the language that will allow

the composition of behaviors

Runtime implementation of interfaces

Compatibility with static type checking/compilation

Questions

1.What is Apache groovy?

2. Why Apache groovy is used?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share this article
Subscribe
By pressing the Subscribe button, you confirm that you have read our Privacy Policy.
Need a Free Demo Class?
Join H2K Infosys IT Online Training
Enroll Free demo class