A function that takes a variable name as a parameter and
returns an Option[String]
value for the variable,
or None
if there is no value
(Map[String, String].get()
, for instance).
true
for a "safe" template that just substitutes
a blank string for an unknown variable, false
for one that throws an exception.
Parse the location of the first variable in string.
Parse the location of the first variable in string.
the string
an Option[Variable]
, specifying the variable's
location; or None
if not found
A function that takes a variable name as a parameter and
returns an Option[String]
value for the variable,
or None
if there is no value
(Map[String, String].get()
, for instance).
true
for a "safe" template that just substitutes
a blank string for an unknown variable, false
for one that throws an exception.
Replace all variable references in the given string.
Replace all variable references in the given string. Variable references are recognized per the regular expression passed to the constructor. If a referenced variable is not found in the resolver, this method either:
- throws a VariableNotFoundException
(if safe
is false
), or
- substitutes an empty string (if safe
is true
)
Recursive references are supported (but beware of infinite recursion).
the string in which to replace variable references
Success(substitutedValue)
or Failure(error)
A simple, configurable string template that substitutes variable references within a string.