Class DefaultPropertiesParser

  • All Implemented Interfaces:
    PropertiesParser

    public class DefaultPropertiesParser
    extends Object
    implements PropertiesParser
    A parser to parse a string which contains property placeholders.
    • Field Detail

      • log

        protected final org.slf4j.Logger log
    • Constructor Detail

      • DefaultPropertiesParser

        public DefaultPropertiesParser()
      • DefaultPropertiesParser

        public DefaultPropertiesParser​(PropertiesComponent propertiesComponent)
    • Method Detail

      • setPropertiesComponent

        public void setPropertiesComponent​(PropertiesComponent propertiesComponent)
      • parseUri

        public String parseUri​(String text,
                               PropertiesLookup properties,
                               boolean defaultFallbackEnabled,
                               boolean keepUnresolvedOptional,
                               boolean nestedPlaceholder)
                        throws IllegalArgumentException
        Description copied from interface: PropertiesParser
        Parses the string and replaces the property placeholders with values from the given properties.
        Specified by:
        parseUri in interface PropertiesParser
        Parameters:
        text - the text to be parsed
        properties - the properties resolved which values should be looked up
        defaultFallbackEnabled - 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

        public String parseProperty​(String key,
                                    String value,
                                    PropertiesLookup properties)
        Description copied from interface: PropertiesParser
        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.

        Specified by:
        parseProperty in interface PropertiesParser
        Parameters:
        key - the key
        value - the value
        properties - the properties resolved which values should be looked up
        Returns:
        the value to use