examples package: Using set expressions
There are two primary ways of setting a Gloop property's value:
||Demonstrates the use of unevaluated set expressions.|
||Demonstrates how to use import statements in set expressions.|
||Demonstrates how the properties of a model are set via set expressions that query a database.|
||Demonstrates how to set a value of a Gloop model via set expressions.|
Please see the following articles for more information:
examples package, navigate to
code folder, and look for a package called
setExpression. This package
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
examples ├── ... └── code └── ... └── setExpression ├── conf │ └── SetExpressionSetup.gloop ├── BasicSetExpression.gloop ├── BCryptHashing.gloop ├── DatabaseLookup.gloop └── GloopModelSetExpression.gloop
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.
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.