Example usage for org.springframework.beans.factory.config PlaceholderConfigurerSupport DEFAULT_PLACEHOLDER_PREFIX

List of usage examples for org.springframework.beans.factory.config PlaceholderConfigurerSupport DEFAULT_PLACEHOLDER_PREFIX

Introduction

In this page you can find the example usage for org.springframework.beans.factory.config PlaceholderConfigurerSupport DEFAULT_PLACEHOLDER_PREFIX.

Prototype

String DEFAULT_PLACEHOLDER_PREFIX

To view the source code for org.springframework.beans.factory.config PlaceholderConfigurerSupport DEFAULT_PLACEHOLDER_PREFIX.

Click Source Link

Document

Default placeholder prefix: .

Usage

From source file:org.springframework.xd.dirt.module.store.ZooKeeperModuleMetadataRepository.java

/**
 * Resolve the module option value using the module metadata.
 *
 * @param metadataMap the values map from ZK module metadata
 * @return the resolved option values/*from   w  w w.  ja va2  s.c o  m*/
 */
private Properties getResolvedModuleOptions(Map<String, String> metadataMap) {
    Map<String, String> optionsMap = new HashMap<String, String>();
    for (Map.Entry<String, String> entry : metadataMap.entrySet()) {
        String propertyKey = entry.getKey();
        String propertyValue = entry.getValue();
        if (!propertyKey.startsWith(XD_MODULE_PROPERTIES_PREFIX) && !StringUtils.isEmpty(propertyValue)) {
            if (propertyValue.startsWith(PlaceholderConfigurerSupport.DEFAULT_PLACEHOLDER_PREFIX)
                    && propertyValue.endsWith(PlaceholderConfigurerSupport.DEFAULT_PLACEHOLDER_SUFFIX)) {
                // For a property ${module.property}, we just extract "module.property" and
                // check if the metadataMap has a value for it.
                String placeholderKey = propertyValue.substring(2, propertyValue.length() - 1);
                if (metadataMap.get(placeholderKey) != null) {
                    propertyValue = metadataMap.get(placeholderKey);
                }
            }
            optionsMap.put(propertyKey, propertyValue);
        }
    }
    return MapUtils.toProperties(optionsMap);
}