StringTemplate
object StringTemplate
Functions for scripting string interpolation.
e.g turn some Context into a string, with use-cases like:
someJsonDoc = """ { "key" : "{{ record.key.toUpperCase }}", "foo" : "{{ if (record.content.path.to.foo) "x" else "y" }}", "double-host" : "{{ env.HOST * 2 }}" } """
Type members
Types
Value members
Concrete methods
Consider the initial remainingExpressionStr:
Consider the initial remainingExpressionStr:
"foo {{ x }} bar {{ y * 2 }} bazz"
This should get translated into a function whose body looks like:
val string1 = "foo "
val string2 = { x.toString() }
val string3 = " bar "
val string4 = { (y * 2).toString }
val string5 = " bazz"
string1 + string2 + string3 + string4 + string5
- Returns
a mapping of variable names to their RHS codetemplate (constants or functions)