Package org.codehaus.mojo.properties
Class PropertyResolver
java.lang.Object
org.codehaus.mojo.properties.PropertyResolver
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate StringfromPropertiesThenSystemThenEnvironment(String key, String defaultValue, Properties properties, Properties environment) getPropertyValue(String key, Properties properties, Properties environment) Retrieves a property value, replacing values like ${token} using the Properties to look them up.getPropertyValue(String key, Properties properties, Properties environment, boolean useDefaultValues) Same as the previous method.
-
Constructor Details
-
PropertyResolver
PropertyResolver()
-
-
Method Details
-
getPropertyValue
Retrieves a property value, replacing values like ${token} using the Properties to look them up. Shamelessly adapted from: http://maven.apache.org/plugins/maven-war-plugin/xref/org/apache/maven/plugin/war/PropertyUtils.html It will leave unresolved properties alone, trying for System properties, and environment variables and implements reparsing (in the case that the value of a property contains a key), and will not loop endlessly on a pair like test = ${test}- Parameters:
key- property keyproperties- project propertiesenvironment- environment variables- Returns:
- resolved property value
- Throws:
IllegalArgumentException- when properties are circularly defined
-
getPropertyValue
public String getPropertyValue(String key, Properties properties, Properties environment, boolean useDefaultValues) Same as the previous method. Accepts an extra flag to indicate whether default values should be processed within property placeholders or not.- Parameters:
key- property keyproperties- project propertiesenvironment- environment variablesuseDefaultValues- process default values flag- Returns:
- resolved property value
- Throws:
IllegalArgumentException- when properties are circularly defined
-
fromPropertiesThenSystemThenEnvironment
private String fromPropertiesThenSystemThenEnvironment(String key, String defaultValue, Properties properties, Properties environment)
-