Class DefaultPropertiesParser
- java.lang.Object
-
- org.apache.camel.component.properties.DefaultPropertiesParser
-
- All Implemented Interfaces:
PropertiesParser
public class DefaultPropertiesParser extends Object implements PropertiesParser
A parser to parse a string which contains property placeholders.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Logger
log
-
Constructor Summary
Constructors Constructor Description DefaultPropertiesParser()
DefaultPropertiesParser(PropertiesComponent propertiesComponent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PropertiesComponent
getPropertiesComponent()
String
parseProperty(String key, String value, PropertiesLookup properties)
While parsing the uri using parseUri method each parsed property found invokes this callback.String
parseUri(String text, PropertiesLookup properties, boolean defaultFallbackEnabled, boolean keepUnresolvedOptional, boolean nestedPlaceholder)
Parses the string and replaces the property placeholders with values from the given properties.void
setPropertiesComponent(PropertiesComponent propertiesComponent)
-
-
-
Constructor Detail
-
DefaultPropertiesParser
public DefaultPropertiesParser()
-
DefaultPropertiesParser
public DefaultPropertiesParser(PropertiesComponent propertiesComponent)
-
-
Method Detail
-
getPropertiesComponent
public PropertiesComponent getPropertiesComponent()
-
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 interfacePropertiesParser
- Parameters:
text
- the text to be parsedproperties
- the properties resolved which values should be looked updefaultFallbackEnabled
- 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
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 interfacePropertiesParser
- Parameters:
key
- the keyvalue
- the valueproperties
- the properties resolved which values should be looked up- Returns:
- the value to use
-
-