org.apache.camel.component.properties
Class DefaultPropertiesParser

java.lang.Object
  extended by org.apache.camel.component.properties.DefaultPropertiesParser
All Implemented Interfaces:
AugmentedPropertyNameAwarePropertiesParser, PropertiesParser

public class DefaultPropertiesParser
extends Object
implements AugmentedPropertyNameAwarePropertiesParser

A parser to parse a string which contains property placeholders

Version:

Field Summary
protected  org.slf4j.Logger log
           
 
Constructor Summary
DefaultPropertiesParser()
           
 
Method Summary
 String parseProperty(String key, String value, Properties properties)
          While parsing the uri using parseUri each parsed property found invokes this callback.
 String parseUri(String text, Properties properties, String prefixToken, String suffixToken)
          Parses the string and replaces the property placeholders with values from the given properties.
 String parseUri(String text, Properties properties, String prefixToken, String suffixToken, String propertyPrefix, String propertySuffix, boolean fallbackToUnaugmentedProperty)
          Parses the string, applying the optional propertyPrefix and propertySuffix to the parsed property names, and replaces the property placeholders with values from the given properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final transient org.slf4j.Logger log
Constructor Detail

DefaultPropertiesParser

public DefaultPropertiesParser()
Method Detail

parseUri

public String parseUri(String text,
                       Properties properties,
                       String prefixToken,
                       String suffixToken)
                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
prefixToken - the prefix token
suffixToken - the suffix token
Returns:
the parsed text with replaced placeholders
Throws:
IllegalArgumentException - if uri syntax is not valid or a property is not found

parseUri

public String parseUri(String text,
                       Properties properties,
                       String prefixToken,
                       String suffixToken,
                       String propertyPrefix,
                       String propertySuffix,
                       boolean fallbackToUnaugmentedProperty)
                throws IllegalArgumentException
Description copied from interface: AugmentedPropertyNameAwarePropertiesParser
Parses the string, applying the optional propertyPrefix and propertySuffix to the parsed property names, and replaces the property placeholders with values from the given properties.

Specified by:
parseUri in interface AugmentedPropertyNameAwarePropertiesParser
Parameters:
text - the text to be parsed
properties - the properties resolved which values should be looked up
prefixToken - the prefix token
suffixToken - the suffix token
propertyPrefix - the optional property name prefix to augment parsed property names with
propertySuffix - the optional property name suffix to augment parsed property names with
fallbackToUnaugmentedProperty - flag indicating if the originally parsed property name should by used for resolution if there is no match to the augmented property name
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,
                            Properties properties)
Description copied from interface: PropertiesParser
While parsing the uri using parseUri 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


Apache CAMEL