Class ChainedPropertyUtil

java.lang.Object
com.puppycrawl.tools.checkstyle.utils.ChainedPropertyUtil

public final class ChainedPropertyUtil extends Object
Resolves chained properties from a user-defined property file.
  • Field Details

  • Constructor Details

  • 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

      private static String getPropertyNameFromExpression(String variableExpression)
      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

      private static boolean allChainedPropertiesAreResolved(String propertyValue)
      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