Interface PropertiesParser
- All Known Implementing Classes:
DefaultPropertiesParser
public interface PropertiesParser
A parser to parse properties for a given input
-
Method Summary
Modifier and TypeMethodDescriptiondefault String
customLookup
(String key) Allow custom providers to attempt to lookup the propertyparseProperty
(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 parsedproperties
- the properties resolved which values should be looked upfallback
- whether to support using fallback values if a property cannot be foundkeepUnresolvedOptional
- whether to keep placeholders that are optional and was unresolvednestedPlaceholder
- 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
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 keyvalue
- the valueproperties
- the properties resolved which values should be looked up- Returns:
- the value to use
-
customLookup
Allow custom providers to attempt to lookup the property- Parameters:
key
- the key- Returns:
- the value if found or null if none found
-