Interface PropertiesParser

All Known Implementing Classes:
DefaultPropertiesParser

public interface PropertiesParser
A parser to parse properties for a given input
  • Method Summary

    Modifier and Type
    Method
    Description
    default String
    Allow custom providers to attempt to lookup the property
    parseProperty(String key, String value, PropertiesLookup properties)
    While parsing the uri using parseUri method each parsed property found invokes this callback.
    parseUri(String text, PropertiesLookup properties, boolean fallback, boolean keepUnresolvedOptional, boolean nestedPlaceholder)
    Parses the string and replaces the property placeholders with values from the given properties.
  • Method Details

    • parseUri

      String parseUri(String text, PropertiesLookup properties, boolean fallback, boolean keepUnresolvedOptional, boolean nestedPlaceholder) throws IllegalArgumentException
      Parses the string and replaces the property placeholders with values from the given properties.
      Parameters:
      text - the text to be parsed
      properties - the properties resolved which values should be looked up
      fallback - whether to support using fallback values if a property cannot be found
      keepUnresolvedOptional - whether to keep placeholders that are optional and was unresolved
      nestedPlaceholder - whether to support nested property placeholders. A nested placeholder, means that a placeholder, has also a placeholder, that should be resolved (recursively).
      Returns:
      the parsed text with replaced placeholders
      Throws:
      IllegalArgumentException - if uri syntax is not valid or a property is not found
    • parseProperty

      String parseProperty(String key, String value, PropertiesLookup properties)
      While parsing the uri using parseUri method each parsed property found invokes this callback.

      This strategy method allows you to hook into the parsing and do custom lookup and return the actual value to use.

      Parameters:
      key - the key
      value - the value
      properties - the properties resolved which values should be looked up
      Returns:
      the value to use
    • customLookup

      default String customLookup(String key)
      Allow custom providers to attempt to lookup the property
      Parameters:
      key - the key
      Returns:
      the value if found or null if none found