examples package: Using Gloop annotations in Groovy
It is important to document your services so other developers know their purpose and how they can be used. Groovy services can be called in Gloop, but comments in Groovy do not get carried over to the Gloop development environment (since they're not included in the resulting class file), and Groovy doesn't allow for as much metadata about a method and its parameters as Gloop does for a service and its inputs and outputs. To address this, Gloop has annotations that you can use to decorate your Groovy code, and add any required metadata for Gloop.
Invoking Groovy in Gloop
examples package contains services that
demonstrate how you can call Groovy in Gloop and vice versa.
examples package includes
gloopDocs.GloopDocsDemo.groovy, a Groovy class whose methods are
annotated with Gloop annotations so that extra metadata about them are visible in Gloop. It shows the use of the
following Gloop annotations:
||Use this annotation to add a method or class-wide comment.|
||Use this annotation to document method parameters and return values in detail.|
||Use this to hide a
||Use this annotation to describe the structure of a Gloop model.|
In the screenshot below, note how the comment for the method appears (1) after the invoke step and the tooltip. Also note how the parameter annotations appear (2) in the Mapper and the tooltip.
Please see the following articles for more information:
To double-check if the annotations work, create a new service and invoke the
GloopDocsDemo.groovy in that service by dragging and dropping
GloopDocsDemo.groovy's methods from the
Navigator view to the Gloop step editor1.
Can all Groovy functions be dragged and dropped?
As long as a Groovy method is
static and isn't annotated with
it can be dragged and dropped from the Navigator.
You must expand
GloopDocsDemo.groovy's tree in the Navigator view to do this. ↩