Interface PropertiesParser

  • All Known Implementing Classes:
    DefaultPropertiesParser

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

      • 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