examples
package: Using set expressions
There are two primary ways of setting a Gloop property's value:
The examples
package shows how set expressions can be used in
services via example services under the setExpression
code directory. Listed below
are the services and their descriptions:
Service Name | Description |
---|---|
BasicSetExpression.gloop |
Demonstrates the use of unevaluated set expressions. |
BCryptHashing.gloop |
Demonstrates how to use import statements in set expressions. |
DatabaseLookup.gloop |
Demonstrates how the properties of a model are set via set expressions that query a database. |
GloopModelSetExpression.gloop |
Demonstrates how to set a value of a Gloop model via set expressions. |
Related articles
Please see the following articles for more information:
Try it!
In the examples
package, navigate to code
folder, and look for a package called setExpression
. This package
has a conf
package that has a pre-configuration service and four services that demonstrate the use
of set expressions, as shown below:
1 2 3 4 5 6 7 8 9 10 11 |
|
Simply open and run these services to inspect their contents and see how they work. These services include documentation (via comments) on how to invoke itself, the expected output, and the purpose of each of its steps.
Explanation
Map lines work best for simple property value mappings. However, for more complex value mappings, set expressions are more ideal. You can use set expressions to assign a default value, or to use Groovy to compute the value instead.