Class VariableReplacer

java.lang.Object
com.elo.gradle.osgi.utils.VariableReplacer

public class VariableReplacer extends Object
Utility class to replace variables in strings
  • Method Details

    • replaceVariable

      public static String replaceVariable(String expression, Map<String,?> properties)
      Replaces a variable in a string. A variable looks like this: ${variable:defaultValue} If a value for this variable is found in the Properties object, this value is prioritised.
      Parameters:
      expression - the string
      properties - the properties object
      Returns:
      the adjusted string
    • registerFunction

      public static final void registerFunction(String name, UnaryOperator<String> function)
      Registers a templating function
      Parameters:
      name - the name of the function
      function - the function to register