Class ChainedPropertyUtil
java.lang.Object
com.puppycrawl.tools.checkstyle.utils.ChainedPropertyUtil
Resolves chained properties from a user-defined property file.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleanallChainedPropertiesAreResolved(String propertyValue) Checks if all chained properties have been resolved.private static StringgetPropertyNameFromExpression(String variableExpression) Gets an unresolved property name from a property variable expression by stripping the preceding '${' and trailing '}'.static PropertiesgetResolvedProperties(Properties properties) Accepts user defined properties and returns new properties with all chained properties resolved.
-
Field Details
-
UNDEFINED_PROPERTY_MESSAGE
Used to report undefined property in exception message.- See Also:
-
PROPERTY_VARIABLE_PATTERN
Property variable expression pattern, matches property variables such as${basedir}.
-
-
Constructor Details
-
ChainedPropertyUtil
private ChainedPropertyUtil()Prevent instantiation.
-
-
Method Details
-
getResolvedProperties
Accepts user defined properties and returns new properties with all chained properties resolved.- Parameters:
properties- the underlying properties to use for property resolution.- Returns:
- resolved properties
- Throws:
CheckstyleException- when chained property is not defined
-
getPropertyNameFromExpression
Gets an unresolved property name from a property variable expression by stripping the preceding '${' and trailing '}'.- Parameters:
variableExpression- the full property variable expression- Returns:
- property name
-
allChainedPropertiesAreResolved
Checks if all chained properties have been resolved. Essentially, this means that there exist no matches for PROPERTY_VARIABLE_PATTERN in the property value string.- Parameters:
propertyValue- the property value to check- Returns:
- true if all chained properties are resolved
-