Class SubstitutionsHandler

java.lang.Object
org.jppf.utils.configuration.SubstitutionsHandler

public class SubstitutionsHandler extends Object
Handles property substitutions in a properties file, that is resolve all. references of the following form in properties values:
 property.name = ${<other.property.name>}
 some.property.name = ${env.<environment_variable_name>}
 other.property.name = ${sys.<system_property_name>}
Author:
Laurent Cohen
  • Field Details

    • SUBST_PATTERN

      public static final Pattern SUBST_PATTERN
      The regex pattern for identifying substitutable property references. This pattern uses explicit reluctant quantifiers, as opposed to the default greedy quantifiers, to avoid problems when multiple property references are found in a single property value.
  • Constructor Details

    • SubstitutionsHandler

      public SubstitutionsHandler()
      Initialize this substitution handler.
  • Method Details

    • resolve

      public <T extends Properties> T resolve(T props)
      Resolve the substitutions in the input TypedProperties object. This method actually changes the property values in the input, i.e. it mutates the input TypedProperties object.
      Type Parameters:
      T - the ytpe of proeprties of object.
      Parameters:
      props - the properties where substitutions must be resolved.
      Returns:
      TypedProperties object in which substitutions have been resolved whenever possible.
    • evaluateProp

      public String evaluateProp(PropertiesCollection<String> resolvedProps, String value)
      Resolve the substitutions for the specified property value.
      Parameters:
      resolvedProps - a set of already resolved properties to evaluate against.
      value - the current value of the property.
      Returns:
      the new value of the property after 0 or more substitutions have been handled.