Class DefaultInterpolator
- All Implemented Interfaces:
- Service,- Interpolator
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic StringEscapes special characters in the given string to prevent unwanted interpolation.interpolate(String val, String currentKey, Set<String> cycleMap, Function<String, String> callback, BiFunction<String, String, String> postprocessor, boolean defaultsToEmpty) interpolate(String val, Function<String, String> callback, BiFunction<String, String, String> postprocessor, boolean defaultsToEmpty) Interpolates a single string value using the provided callback function.voidinterpolate(Map<String, String> map, Function<String, String> callback, BiFunction<String, String, String> postprocessor, boolean defaultsToEmpty) Interpolates the values in the given map using the provided callback function.voidPerform substitution on a property setvoidperformSubstitution(Map<String, String> properties, Function<String, String> callback, boolean defaultsToEmptyString) Perform substitution on a property setThis method performs property variable substitution on the specified value.substVars(String val, String currentKey, Set<String> cycleMap, Map<String, String> configProps, Function<String, String> callback) This method performs property variable substitution on the specified value.static StringsubstVars(String val, String currentKey, Set<String> cycleMap, Map<String, String> configProps, Function<String, String> callback, BiFunction<String, String, String> postprocessor, boolean defaultsToEmptyString) This method performs property variable substitution on the specified value.static StringUnescapes previously escaped characters in the given string.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.maven.api.services.Interpolatorinterpolate, interpolate, interpolate, interpolate
- 
Constructor Details- 
DefaultInterpolatorpublic DefaultInterpolator()
 
- 
- 
Method Details- 
interpolatepublic void interpolate(Map<String, String> map, Function<String, String> callback, BiFunction<String, String, String> postprocessor, boolean defaultsToEmpty) Description copied from interface:InterpolatorInterpolates the values in the given map using the provided callback function.- Specified by:
- interpolatein interface- Interpolator
- Parameters:
- map- The map containing key-value pairs to be interpolated.
- callback- The function to resolve variable values not found in the map.
- defaultsToEmpty- If true, unresolved placeholders are replaced with empty strings. If false, they are left unchanged.
 
- 
interpolatepublic String interpolate(String val, Function<String, String> callback, BiFunction<String, String, String> postprocessor, boolean defaultsToEmpty) Description copied from interface:InterpolatorInterpolates a single string value using the provided callback function.- Specified by:
- interpolatein interface- Interpolator
- Parameters:
- val- The string to be interpolated.
- callback- The function to resolve variable values.
- defaultsToEmpty- If true, unresolved placeholders are replaced with empty strings.
- Returns:
- The interpolated string, or null if the input was null.
 
- 
interpolate
- 
performSubstitutionPerform substitution on a property set- Parameters:
- properties- the property set to perform substitution on
- callback- Callback for substitution
 
- 
performSubstitutionpublic void performSubstitution(Map<String, String> properties, Function<String, String> callback, boolean defaultsToEmptyString) Perform substitution on a property set- Parameters:
- properties- the property set to perform substitution on
- callback- the callback to obtain substitution values
- defaultsToEmptyString- sets an empty string if a replacement value is not found, leaves intact otherwise
 
- 
substVarspublic String substVars(String val, String currentKey, Set<String> cycleMap, Map<String, String> configProps) This method performs property variable substitution on the specified value. If the specified value contains the syntax ${<prop-name>}, where<prop-name>refers to either a configuration property or a system property, then the corresponding property value is substituted for the variable placeholder. Multiple variable placeholders may exist in the specified value as well as nested variable placeholders, which are substituted from inner most to outer most. Configuration properties override system properties.- Parameters:
- val- The string on which to perform property substitution.
- currentKey- The key of the property being evaluated used to detect cycles.
- cycleMap- Map of variable references used to detect nested cycles.
- configProps- Set of configuration properties.
- Returns:
- The value of the specified string after system property substitution.
- Throws:
- InterpolatorException- If there was a syntax error in the property placeholder syntax or a recursive variable reference.
 
- 
substVarspublic String substVars(String val, String currentKey, Set<String> cycleMap, Map<String, String> configProps, Function<String, String> callback) This method performs property variable substitution on the specified value. If the specified value contains the syntax ${<prop-name>}, where<prop-name>refers to either a configuration property or a system property, then the corresponding property value is substituted for the variable placeholder. Multiple variable placeholders may exist in the specified value as well as nested variable placeholders, which are substituted from inner most to outer most. Configuration properties override system properties.- Parameters:
- val- The string on which to perform property substitution.
- currentKey- The key of the property being evaluated used to detect cycles.
- cycleMap- Map of variable references used to detect nested cycles.
- configProps- Set of configuration properties.
- callback- the callback to obtain substitution values
- Returns:
- The value of the specified string after system property substitution.
- Throws:
- InterpolatorException- If there was a syntax error in the property placeholder syntax or a recursive variable reference.
 
- 
substVarspublic static String substVars(String val, String currentKey, Set<String> cycleMap, Map<String, String> configProps, Function<String, String> callback, BiFunction<String, String, String> postprocessor, boolean defaultsToEmptyString) This method performs property variable substitution on the specified value. If the specified value contains the syntax ${<prop-name>}, where<prop-name>refers to either a configuration property or a system property, then the corresponding property value is substituted for the variable placeholder. Multiple variable placeholders may exist in the specified value as well as nested variable placeholders, which are substituted from inner most to outer most. Configuration properties override system properties.- Parameters:
- val- The string on which to perform property substitution.
- currentKey- The key of the property being evaluated used to detect cycles.
- cycleMap- Map of variable references used to detect nested cycles.
- configProps- Set of configuration properties.
- callback- the callback to obtain substitution values
- defaultsToEmptyString- sets an empty string if a replacement value is not found, leaves intact otherwise
- Returns:
- The value of the specified string after system property substitution.
- Throws:
- IllegalArgumentException- If there was a syntax error in the property placeholder syntax or a recursive variable reference.
 
- 
escapeEscapes special characters in the given string to prevent unwanted interpolation.- Parameters:
- val- The string to be escaped.
- Returns:
- The escaped string.
 
- 
unescapeUnescapes previously escaped characters in the given string.- Parameters:
- val- The string to be unescaped.
- Returns:
- The unescaped string.
 
 
-