Package org.jppf.utils.configuration
Class SubstitutionsHandler
java.lang.Object
org.jppf.utils.configuration.SubstitutionsHandler
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final PatternThe regex pattern for identifying substitutable property references. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionevaluateProp(PropertiesCollection<String> resolvedProps, String value) Resolve the substitutions for the specified property value.<T extends Properties>
Tresolve(T props) Resolve the substitutions in the inputTypedPropertiesobject.
-
Field Details
-
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
Resolve the substitutions in the inputTypedPropertiesobject. This method actually changes the property values in the input, i.e. it mutates the inputTypedPropertiesobject.- 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
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.
-