Example usage for org.springframework.beans MutablePropertyValues add

List of usage examples for org.springframework.beans MutablePropertyValues add

Introduction

In this page you can find the example usage for org.springframework.beans MutablePropertyValues add.

Prototype

public MutablePropertyValues add(String propertyName, @Nullable Object propertyValue) 

Source Link

Document

Add a PropertyValue object, replacing any existing one for the corresponding property or getting merged with it (if applicable).

Usage

From source file:org.springframework.data.gemfire.config.xml.GemfireDataSourceParser.java

/**
 * {@inheritDoc}/* w ww .  ja va2  s  .c om*/
 */
@Override
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
    BeanDefinition clientCacheDefinition = new ClientCacheParser().parse(element, parserContext);

    parserContext.getRegistry().registerBeanDefinition(GemfireConstants.DEFAULT_GEMFIRE_CACHE_NAME,
            clientCacheDefinition);

    BeanDefinition poolDefinition = new PoolParser().parse(element, parserContext);

    MutablePropertyValues poolProperties = poolDefinition.getPropertyValues();

    if (!element.hasAttribute(SUBSCRIPTION_ENABLED_ATTRIBUTE_NAME)) {
        poolProperties.add(SUBSCRIPTION_ENABLED_PROPERTY_NAME, true);
    }

    parserContext.getRegistry().registerBeanDefinition(GemfireConstants.DEFAULT_GEMFIRE_POOL_NAME,
            poolDefinition);

    if (log.isDebugEnabled()) {
        log.debug(String.format("Registered GemFire ClientCache bean [%1$s] of type [%2$s]%n",
                GemfireConstants.DEFAULT_GEMFIRE_CACHE_NAME, clientCacheDefinition.getBeanClassName()));
    }

    BeanDefinitionBuilder builder = BeanDefinitionBuilder
            .genericBeanDefinition(GemfireDataSourcePostProcessor.class);

    builder.addConstructorArgReference(GemfireConstants.DEFAULT_GEMFIRE_CACHE_NAME);

    BeanDefinitionReaderUtils.registerWithGeneratedName(builder.getBeanDefinition(),
            parserContext.getRegistry());

    return null;
}