Class InterpolationHelper
- java.lang.Object
-
- org.apache.felix.utils.properties.InterpolationHelper
-
public class InterpolationHelper extends java.lang.ObjectEnhancement of the standard
Propertiesmanaging the maintain of comments, etc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classInterpolationHelper.BundleContextSubstitutionCallbackstatic interfaceInterpolationHelper.SubstitutionCallbackCallback for substitution
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringDELIM_STARTprivate static java.lang.StringDELIM_STOPprivate static java.lang.StringENV_PREFIXprivate static charESCAPE_CHARprivate static java.lang.StringMARKER
-
Constructor Summary
Constructors Modifier Constructor Description privateInterpolationHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.StringdoSubstVars(java.lang.String val, java.lang.String currentKey, java.util.Map<java.lang.String,java.lang.String> cycleMap, java.util.Map<java.lang.String,java.lang.String> configProps, InterpolationHelper.SubstitutionCallback callback, boolean substituteFromConfig, boolean substituteFromSystemProperties, boolean defaultsToEmptyString)static voidperformSubstitution(java.util.Map<java.lang.String,java.lang.String> properties)Perform substitution on a property setstatic voidperformSubstitution(java.util.Map<java.lang.String,java.lang.String> properties, InterpolationHelper.SubstitutionCallback callback)Perform substitution on a property setstatic voidperformSubstitution(java.util.Map<java.lang.String,java.lang.String> properties, InterpolationHelper.SubstitutionCallback callback, boolean substituteFromConfig, boolean substituteFromSystemProperties, boolean defaultsToEmptyString)Perform substitution on a property setstatic voidperformSubstitution(java.util.Map<java.lang.String,java.lang.String> properties, org.osgi.framework.BundleContext context)Perform substitution on a property setstatic java.lang.StringsubstVars(java.lang.String val, java.lang.String currentKey, java.util.Map<java.lang.String,java.lang.String> cycleMap, java.util.Map<java.lang.String,java.lang.String> configProps)This method performs property variable substitution on the specified value.static java.lang.StringsubstVars(java.lang.String val, java.lang.String currentKey, java.util.Map<java.lang.String,java.lang.String> cycleMap, java.util.Map<java.lang.String,java.lang.String> configProps, InterpolationHelper.SubstitutionCallback callback)This method performs property variable substitution on the specified value.static java.lang.StringsubstVars(java.lang.String val, java.lang.String currentKey, java.util.Map<java.lang.String,java.lang.String> cycleMap, java.util.Map<java.lang.String,java.lang.String> configProps, InterpolationHelper.SubstitutionCallback callback, boolean substituteFromConfig, boolean substituteFromSystemProperties, boolean defaultsToEmptyString)This method performs property variable substitution on the specified value.static java.lang.StringsubstVars(java.lang.String val, java.lang.String currentKey, java.util.Map<java.lang.String,java.lang.String> cycleMap, java.util.Map<java.lang.String,java.lang.String> configProps, org.osgi.framework.BundleContext context)This method performs property variable substitution on the specified value.private static java.lang.Stringunescape(java.lang.String val)
-
-
-
Field Detail
-
ESCAPE_CHAR
private static final char ESCAPE_CHAR
- See Also:
- Constant Field Values
-
DELIM_START
private static final java.lang.String DELIM_START
- See Also:
- Constant Field Values
-
DELIM_STOP
private static final java.lang.String DELIM_STOP
- See Also:
- Constant Field Values
-
MARKER
private static final java.lang.String MARKER
- See Also:
- Constant Field Values
-
ENV_PREFIX
private static final java.lang.String ENV_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
performSubstitution
public static void performSubstitution(java.util.Map<java.lang.String,java.lang.String> properties)
Perform substitution on a property set- Parameters:
properties- the property set to perform substitution on
-
performSubstitution
public static void performSubstitution(java.util.Map<java.lang.String,java.lang.String> properties, org.osgi.framework.BundleContext context)Perform substitution on a property set- Parameters:
properties- the property set to perform substitution oncontext- The bundle context
-
performSubstitution
public static void performSubstitution(java.util.Map<java.lang.String,java.lang.String> properties, InterpolationHelper.SubstitutionCallback callback)Perform substitution on a property set- Parameters:
properties- the property set to perform substitution oncallback- Callback for substituion
-
performSubstitution
public static void performSubstitution(java.util.Map<java.lang.String,java.lang.String> properties, InterpolationHelper.SubstitutionCallback callback, boolean substituteFromConfig, boolean substituteFromSystemProperties, boolean defaultsToEmptyString)Perform substitution on a property set- Parameters:
properties- the property set to perform substitution oncallback- the callback to obtain substitution valuessubstituteFromConfig- If substitute from configurationsubstituteFromSystemProperties- If substitute from system propertiesdefaultsToEmptyString- sets an empty string if a replacement value is not found, leaves intact otherwise
-
substVars
public static java.lang.String substVars(java.lang.String val, java.lang.String currentKey, java.util.Map<java.lang.String,java.lang.String> cycleMap, java.util.Map<java.lang.String,java.lang.String> configProps) throws java.lang.IllegalArgumentExceptionThis 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:
java.lang.IllegalArgumentException- If there was a syntax error in the property placeholder syntax or a recursive variable reference.
-
substVars
public static java.lang.String substVars(java.lang.String val, java.lang.String currentKey, java.util.Map<java.lang.String,java.lang.String> cycleMap, java.util.Map<java.lang.String,java.lang.String> configProps, org.osgi.framework.BundleContext context) throws java.lang.IllegalArgumentExceptionThis 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.context- the bundle context to retrieve properties from- Returns:
- The value of the specified string after system property substitution.
- Throws:
java.lang.IllegalArgumentException- If there was a syntax error in the property placeholder syntax or a recursive variable reference.
-
substVars
public static java.lang.String substVars(java.lang.String val, java.lang.String currentKey, java.util.Map<java.lang.String,java.lang.String> cycleMap, java.util.Map<java.lang.String,java.lang.String> configProps, InterpolationHelper.SubstitutionCallback callback) throws java.lang.IllegalArgumentExceptionThis 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:
java.lang.IllegalArgumentException- If there was a syntax error in the property placeholder syntax or a recursive variable reference.
-
substVars
public static java.lang.String substVars(java.lang.String val, java.lang.String currentKey, java.util.Map<java.lang.String,java.lang.String> cycleMap, java.util.Map<java.lang.String,java.lang.String> configProps, InterpolationHelper.SubstitutionCallback callback, boolean substituteFromConfig, boolean substituteFromSystemProperties, boolean defaultsToEmptyString) throws java.lang.IllegalArgumentExceptionThis 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 valuessubstituteFromConfig- If substitute from configurationsubstituteFromSystemProperties- If substitute from system propertiesdefaultsToEmptyString- 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:
java.lang.IllegalArgumentException- If there was a syntax error in the property placeholder syntax or a recursive variable reference.
-
doSubstVars
private static java.lang.String doSubstVars(java.lang.String val, java.lang.String currentKey, java.util.Map<java.lang.String,java.lang.String> cycleMap, java.util.Map<java.lang.String,java.lang.String> configProps, InterpolationHelper.SubstitutionCallback callback, boolean substituteFromConfig, boolean substituteFromSystemProperties, boolean defaultsToEmptyString) throws java.lang.IllegalArgumentException- Throws:
java.lang.IllegalArgumentException
-
unescape
private static java.lang.String unescape(java.lang.String val)
-
-