Class VariableStringResolver
- java.lang.Object
-
- io.wcm.devops.conga.generator.util.VariableStringResolver
-
public final class VariableStringResolver extends Object
Resolve variables in a string referencing entries from a map.
-
-
Constructor Summary
Constructors Constructor Description VariableStringResolver(ValueProviderGlobalContext valueProviderGlobalContext, VariableMapResolver variableMapResolver)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
deescape(String value)
De-escapes all escaped variables in the given string.static boolean
hasValueProviderReference(String value)
Checks if the given string contains any reference to a variable from a value provider.Object
resolve(String value, Map<String,Object> variables)
Replace variable placeholders in a string with syntax ${key} with values from a map.Object
resolve(String value, Map<String,Object> variables, boolean deescapeVariables)
Replace variable placeholders in a string with syntax ${key} with values from a map.String
resolveString(String value, Map<String,Object> variables)
Replace variable placeholders in a string with syntax ${key} with values from a map.String
resolveString(String value, Map<String,Object> variables, boolean deescapeVariables)
Replace variable placeholders in a string with syntax ${key} with values from a map.
-
-
-
Constructor Detail
-
VariableStringResolver
public VariableStringResolver(ValueProviderGlobalContext valueProviderGlobalContext, VariableMapResolver variableMapResolver)
- Parameters:
valueProviderGlobalContext
- Value provider global contextvariableMapResolver
- Variable map resolver
-
-
Method Detail
-
resolveString
public String resolveString(String value, Map<String,Object> variables)
Replace variable placeholders in a string with syntax ${key} with values from a map. The variables can recursively reference each other. All escaped variables are deescaped.- Parameters:
value
- Value with variable placeholdersvariables
- Variable map- Returns:
- Value with variable placeholders resolved.
- Throws:
IllegalArgumentException
- when a variable name could not be resolve.d
-
resolve
public Object resolve(String value, Map<String,Object> variables)
Replace variable placeholders in a string with syntax ${key} with values from a map. The variables can recursively reference each other. All escaped variables are deescaped.- Parameters:
value
- Value with variable placeholdersvariables
- Variable map- Returns:
- Value with variable placeholders resolved.
- Throws:
IllegalArgumentException
- when a variable name could not be resolve.d
-
resolveString
public String resolveString(String value, Map<String,Object> variables, boolean deescapeVariables)
Replace variable placeholders in a string with syntax ${key} with values from a map. The variables can recursively reference each other.- Parameters:
value
- Value with variable placeholdersvariables
- Variable mapdeescapeVariables
- If true,deescape(String)
is applied to the result string- Returns:
- Value with variable placeholders resolved.
- Throws:
IllegalArgumentException
- when a variable name could not be resolve.d
-
resolve
public Object resolve(String value, Map<String,Object> variables, boolean deescapeVariables)
Replace variable placeholders in a string with syntax ${key} with values from a map. The variables can recursively reference each other.- Parameters:
value
- Value with variable placeholdersvariables
- Variable mapdeescapeVariables
- If true,deescape(String)
is applied to the result string- Returns:
- Value with variable placeholders resolved.
- Throws:
IllegalArgumentException
- when a variable name could not be resolve.d
-
deescape
public String deescape(String value)
De-escapes all escaped variables in the given string.- Parameters:
value
- String that may contain escaped variable references (starting with \$)- Returns:
- String with de-escaped variable references.
-
hasValueProviderReference
public static boolean hasValueProviderReference(String value)
Checks if the given string contains any reference to a variable from a value provider.- Parameters:
value
- Value string- Returns:
- true if a value provider reference was found.
-
-