-
Notifications
You must be signed in to change notification settings - Fork 0
Sbet template Syntax
etiennec edited this page Sep 24, 2016
·
2 revisions
Text is inserted in templates with {{ ... }}.
There's no notion of scope, so everything that you write in the curly braces is evaluated against the Map<String, Object> "data map" that is passed to the template. Everything is case-sensitive in Sbet.
In these double curly braces, you can put:
- A single name: {{ serialId }} . Sbet will call the ".toString()" method of the object which has key "serialId" in the data map.
- Chained properties: {{ customer.address.postalCode }} . Sbet will retrieve the first element ("flowers") from the data map, and will then get each of the following object properties, and call "toString()" on the last one.
- Indexed Property: {{ customer.purchases[2].price }}. Use this if you want to retrieve the n^th element of an array or a java.util.List.
- Mapped Property: {{ garden.flowers(rose).color }}. Use this if you want to retrieve an object from a java.util.Map<String, ?>.