public abstract class VariableResolver extends Object implements Translator
Translator
that does variable resolution in the Ant style.
This implementation looks for variables in the string like
"${xyz}" or "${abc.DEF.ghi}". The getVariableValue(String)
method
is then used to obtain the actual value for the variable.
"$$" works as the escape of "$", so for example "$${abc}" expands to "${abc}" where "${abc}" would have expanded to "value-of-abc". A lone "$" is left as-is, so "$abc" expands to "$abc".
NOOP, SYS_PROP_TR
Constructor and Description |
---|
VariableResolver() |
Modifier and Type | Method and Description |
---|---|
protected abstract String |
getVariableValue(String varName)
Returns the value of the variable.
|
String |
translate(String str) |
public String translate(String str) throws TranslationException
translate
in interface Translator
TranslationException
protected abstract String getVariableValue(String varName) throws TranslationException
TranslationException
,
which is an useful technique if the implementation would like to report
additional errors.TranslationException
Copyright © 2021. All rights reserved.