Skip to content

Home

Introduction

Development

IDEs

Services

Service manager

API Explorer

examples package: Using Gloop annotations in Groovy

It is important to document your services so other developers know their purpose and how they should be used. Groovy services can be called in Gloop but comments in Groovy do not get carried over to the Gloop development environment easily. To make this possible, you must decorate your Groovy code with Gloop annotations.

Invoking Groovy in Gloop

The examples package contains services that demonstrate how you can call Groovy in Gloop and vice versa.

The examples package includes gloopDocs.GloopDocsDemo.groovy, a Groovy service whose methods are annotated with Gloop annotations so that their documentation is still visible in Gloop. It shows the use of the following Gloop annotations:

Annotation Description
@GloopComment Use this annotation to add a method or service-wide comment.
@GloopParameter Use this annotation to document method parameters and return values in detail.
@GloopHide Use this to hide a Groovy method from Gloop.
@GloopObjectParameter Use this annotation to describe what a method accepts or returns. This works like @GloopParameter, albeit less specific and creates similar comments for the input and output values.

You can easily check that these annotations work by creating a new Gloop service and then dragging any of GloopDocsDemo.groovy's methods to it, thereby creating a new invoke step.

Gloop service using one of `GloopDocsDemo.groovy`'s methods

Related articles

Please see the following articles for more information:

Try it!

To double-check if the annotations work, create a new Gloop service and call the methods of GloopDocsDemo.groovy in that service by dragging and dropping GloopDocsDemo.groovy's methods from the Coder Navigator view to the Gloop step editor1.

Invoking Groovy in Gloop

Invoking Groovy in Gloop

Can all Groovy methods be dragged and dropped?

As long as the Groovy methods are static, they can be dragged and dropped from the Coder Navigator.


  1. You must expand GloopDocsDemo.groovy's tree in the Coder Navigator view to do this.