Skip to content

Overview

Development

Overview

IDEs

API Explorer

Creating a Groovy Service

Just follow the steps below to create your own Groovy service:

Creating a Groovy service

Creating a Groovy service

  1. Under your target Integrate package, right click on the code directory or any of the packages underneath 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. You will also be given the option to change the values of the following 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 of your Groovy class
  3. Click Finish. At this point, your Groovy file should have been created for you.

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.

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