Enum Class PropertyPlaceholderHelper

java.lang.Object
java.lang.Enum<PropertyPlaceholderHelper>
org.apache.skywalking.apm.util.PropertyPlaceholderHelper
All Implemented Interfaces:
Serializable, Comparable<PropertyPlaceholderHelper>, Constable

public enum PropertyPlaceholderHelper extends Enum<PropertyPlaceholderHelper>
Utility class for working with Strings that have placeholder values in them. A placeholder takes the form ${name}. Using PropertyPlaceholderHelper these placeholders can be substituted for user-supplied values.

Values for substitution can be supplied using a Properties instance or using a PropertyPlaceholderHelper.PlaceholderResolver.

  • Enum Constant Details

  • Method Details

    • values

      public static PropertyPlaceholderHelper[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static PropertyPlaceholderHelper valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • replacePlaceholders

      public String replacePlaceholders(String value, Properties properties)
      Replaces all placeholders of format ${name} with the corresponding property from the supplied Properties.
      Parameters:
      value - the value containing the placeholders to be replaced
      properties - the Properties to use for replacement
      Returns:
      the supplied value with placeholders replaced inline
    • replacePlaceholders

      public String replacePlaceholders(String value, PropertyPlaceholderHelper.PlaceholderResolver placeholderResolver)
      Replaces all placeholders of format ${name} with the value returned from the supplied PropertyPlaceholderHelper.PlaceholderResolver.
      Parameters:
      value - the value containing the placeholders to be replaced
      placeholderResolver - the PlaceholderResolver to use for replacement
      Returns:
      the supplied value with placeholders replaced inline
    • parseStringValue

      protected String parseStringValue(String value, PropertyPlaceholderHelper.PlaceholderResolver placeholderResolver, Set<String> visitedPlaceholders)