You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by gn...@apache.org on 2014/02/21 17:16:58 UTC
svn commit: r1570618 -
/felix/trunk/utils/src/main/java/org/apache/felix/utils/properties/InterpolationHelper.java
Author: gnodet
Date: Fri Feb 21 16:16:57 2014
New Revision: 1570618
URL: http://svn.apache.org/r1570618
Log:
[FELIX-4435] Add a method to do substitution without any callback
Modified:
felix/trunk/utils/src/main/java/org/apache/felix/utils/properties/InterpolationHelper.java
Modified: felix/trunk/utils/src/main/java/org/apache/felix/utils/properties/InterpolationHelper.java
URL: http://svn.apache.org/viewvc/felix/trunk/utils/src/main/java/org/apache/felix/utils/properties/InterpolationHelper.java?rev=1570618&r1=1570617&r2=1570618&view=diff
==============================================================================
--- felix/trunk/utils/src/main/java/org/apache/felix/utils/properties/InterpolationHelper.java (original)
+++ felix/trunk/utils/src/main/java/org/apache/felix/utils/properties/InterpolationHelper.java Fri Feb 21 16:16:57 2014
@@ -101,6 +101,37 @@ public class InterpolationHelper {
* detect cycles.
* @param cycleMap Map of variable references used to detect nested cycles.
* @param configProps Set of configuration properties.
+ * @return 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.
+ **/
+ public static String substVars(String val,
+ String currentKey,
+ Map<String,String> cycleMap,
+ Map<String,String> configProps)
+ throws IllegalArgumentException
+ {
+ return substVars(val, currentKey, cycleMap, configProps, (SubstitutionCallback) null);
+ }
+
+ /**
+ * <p>
+ * This method performs property variable substitution on the
+ * specified value. If the specified value contains the syntax
+ * <tt>${<prop-name>}</tt>, where <tt><prop-name></tt>
+ * 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.
+ * </p>
+ *
+ * @param val The string on which to perform property substitution.
+ * @param currentKey The key of the property being evaluated used to
+ * detect cycles.
+ * @param cycleMap Map of variable references used to detect nested cycles.
+ * @param configProps Set of configuration properties.
* @param context the bundle context to retrieve properties from
* @return The value of the specified string after system property substitution.
* @throws IllegalArgumentException If there was a syntax error in the