Skip to content

Overview

Concepts and Principles

Development

Overview

IDEs

API Explorer

Releases

Release Notes

TORO Integrate

Coder Studio

Coder Cloud

Bug Reports

Search

Creating a Groovy Service

Just follow the steps below to create your own Groovy Service!

  1. Under your target Integrate Package, right click on the code package or any of the packages under it where you'd like your Groovy service to reside, and then choose New > Groovy Class.
  2. Enter the file name (class name) of your Groovy Service.

    In Coder Studio, you will also be given the option to fill up the following other fields in the wizard:

    • Location - where the to-be-created Groovy Service will reside; the default value is the folder where you did the right click
    • Kind - the type of Groovy file you'll be creating – class, interface, enum, annotation, etc.
    • Modifiers - the modifiers for your Groovy class
  3. Click Finish. At this point, your Groovy file should have been created for you.

  4. Coder will automatically open the Groovy file where you can proceed to fill it up with code. Save your file for the changes to take effect.

Here's a short GIF showing you the process:

Creating a Groovy service

Creating a Groovy service

Cursor keys

While you're editing the name of the class, you can use the up and down cursor keys to choose its Kind (or type).

Compilation Requirements

For your code to compile, TORO Integrate requires that you observe the following additional rules1:

  • If you're going to create a Groovy class (as opposed to a script), the name of the file and class must be the same. For example, a file named Employee.groovy should have its class declared like so:

    1
    2
    3
    class Employee {
        ...
    }
    
  • There should only be a single top-level class in each .groovy file. This means the following is invalid:

    1
    2
    3
    4
    5
    6
    7
    class One {
        ...
    }
    
    class Two {
        ...
    }
    
  • The declared package name and the directory where the Groovy file is located should match.

Even if your code fails to compile, what you wrote will still be saved; but because compilation failed, this means that you won't be able to use your class or script with other integration components.


  1. aside from the requirements of the native Groovy compiler