Example usage for org.springframework.beans MutablePropertyValues addPropertyValue

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

Introduction

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

Prototype

public MutablePropertyValues addPropertyValue(PropertyValue pv) 

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.springmodules.cache.config.CommonsAttributesParser.java

/**
 * Adds a reference to a <code>{@link CommonsAttributes}</code> as a
 * property of the caching interceptor.//from www .  ja v  a2  s.c o m
 * 
 * @param propertyValues
 *          the set of properties of the caching interceptor
 * @param registry
 *          the registry of bean definitions
 * 
 * @see AbstractMetadataAttributesParser#configureCachingInterceptor(MutablePropertyValues,
 *      BeanDefinitionRegistry)
 */
protected void configureCachingInterceptor(MutablePropertyValues propertyValues,
        BeanDefinitionRegistry registry) {
    propertyValues.addPropertyValue(getAttributesProperty());
}

From source file:org.springmodules.cache.config.CommonsAttributesParser.java

/**
 * Adds a reference to a <code>{@link CommonsAttributes}</code> as a
 * property of the flushing interceptor.
 * /*w  w w  .  j  a v  a 2s.  c om*/
 * @param propertyValues
 *          the set of properties of the flushing interceptor
 * @param registry
 *          the registry of bean definitions
 * 
 * @see AbstractMetadataAttributesParser#configureFlushingInterceptor(MutablePropertyValues,
 *      BeanDefinitionRegistry)
 */
protected void configureFlushingInterceptor(MutablePropertyValues propertyValues,
        BeanDefinitionRegistry registry) {
    propertyValues.addPropertyValue(getAttributesProperty());
}

From source file:org.springmodules.cache.config.CacheSetupStrategyPropertySource.java

/**
 * Returns the properties specified by:/*w w w  . j a  va2s. c  o m*/
 * <ul>
 * <li><code>{@link #getCacheProviderFacadeProperty()}</code></li>
 * <li><code>{@link #getCachingListenersProperty()}</code></li>
 * <li><code>{@link #getCachingModelsProperty()}</code></li>
 * <li><code>{@link #getFlushingModelsProperty()}</code></li>
 * </ul>
 * 
 * @return all the properties stored in this object.
 */
public MutablePropertyValues getAllProperties() {
    MutablePropertyValues allPropertyValues = new MutablePropertyValues();
    allPropertyValues.addPropertyValue(getCacheKeyGeneratorProperty());
    allPropertyValues.addPropertyValue(getCacheProviderFacadeProperty());
    allPropertyValues.addPropertyValue(getCachingListenersProperty());
    allPropertyValues.addPropertyValue(getCachingModelsProperty());
    allPropertyValues.addPropertyValue(getFlushingModelsProperty());

    return allPropertyValues;
}

From source file:org.browsexml.timesheetjob.web.SimpleWebApplicationContext.java

public void refresh() throws BeansException {
    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue(new PropertyValue("commandClass", "org.springframework.beans.TestBean"));
    pvs.addPropertyValue(new PropertyValue("formView", "form"));
    //registerSingleton("/form.do", HoursWorkedFormController.class, pvs);

    //registerSingleton("/locale.do", LocaleChecker.class);

    //registerPrototype("/throwaway.do", TestThrowawayController.class);

    addMessage("test", Locale.ENGLISH, "test message");
    addMessage("test", Locale.CANADA, "Canadian & test message");
    addMessage("testArgs", Locale.ENGLISH, "test {0} message {1}");
    addMessage("testArgsFormat", Locale.ENGLISH, "test {0} message {1,number,#.##} X");

    registerSingleton(UiApplicationContextUtils.THEME_SOURCE_BEAN_NAME, DummyThemeSource.class);

    super.refresh();
}

From source file:org.springmodules.cache.config.AbstractMetadataAttributesParser.java

private void registerFlushingInterceptor(BeanDefinitionRegistry registry,
        CacheSetupStrategyPropertySource propertySource) {

    MutablePropertyValues propertyValues = new MutablePropertyValues();
    propertyValues.addPropertyValue(propertySource.getCacheProviderFacadeProperty());
    propertyValues.addPropertyValue(propertySource.getFlushingModelsProperty());

    RootBeanDefinition flushingInterceptor = new RootBeanDefinition(MetadataFlushingInterceptor.class,
            propertyValues);//  w ww  .j a  v a 2s .co m

    configureFlushingInterceptor(propertyValues, registry);

    String beanName = BeanName.FLUSHING_INTERCEPTOR;
    registry.registerBeanDefinition(beanName, flushingInterceptor);
}

From source file:org.springmodules.cache.config.AbstractMetadataAttributesParser.java

private void registerCachingInterceptor(BeanDefinitionRegistry registry,
        CacheSetupStrategyPropertySource propertySource) {

    MutablePropertyValues propertyValues = new MutablePropertyValues();
    propertyValues.addPropertyValue(propertySource.getCacheKeyGeneratorProperty());
    propertyValues.addPropertyValue(propertySource.getCacheProviderFacadeProperty());
    propertyValues.addPropertyValue(propertySource.getCachingListenersProperty());
    propertyValues.addPropertyValue(propertySource.getCachingModelsProperty());

    RootBeanDefinition cachingInterceptor = new RootBeanDefinition(MetadataCachingInterceptor.class,
            propertyValues);/*www  . ja v a  2s . co m*/

    configureCachingInterceptor(propertyValues, registry);

    String beanName = BeanName.CACHING_INTERCEPTOR;
    registry.registerBeanDefinition(beanName, cachingInterceptor);
}

From source file:org.springmodules.cache.config.AbstractCacheManagerAndProviderFacadeParser.java

/**
 * Parses the given XML element containing the properties of the cache manager
 * to register in the given registry of bean definitions.
 * //  w ww.j  ava  2s .co m
 * @param element
 *          the XML element to parse
 * @param registry
 *          the registry of bean definitions
 * 
 * @see AbstractCacheProviderFacadeParser#doParse(String, Element,
 *      BeanDefinitionRegistry)
 */
protected final void doParse(String cacheProviderFacadeId, Element element, BeanDefinitionRegistry registry) {
    String id = "cacheManager";
    Class clazz = getCacheManagerClass();
    RootBeanDefinition cacheManager = new RootBeanDefinition(clazz);
    MutablePropertyValues cacheManagerProperties = new MutablePropertyValues();
    cacheManager.setPropertyValues(cacheManagerProperties);

    PropertyValue configLocation = parseConfigLocationProperty(element);
    cacheManagerProperties.addPropertyValue(configLocation);
    registry.registerBeanDefinition(id, cacheManager);

    BeanDefinition cacheProviderFacade = registry.getBeanDefinition(cacheProviderFacadeId);
    cacheProviderFacade.getPropertyValues().addPropertyValue("cacheManager", new RuntimeBeanReference(id));
}

From source file:org.springmodules.cache.config.MethodMapInterceptorsParser.java

private void registerCachingInterceptor(String cachingInterceptorId, BeanDefinitionRegistry registry,
        CacheSetupStrategyPropertySource propertySource) {

    MutablePropertyValues propertyValues = new MutablePropertyValues();

    RootBeanDefinition cachingInterceptor = new RootBeanDefinition(MethodMapCachingInterceptor.class,
            propertyValues);//from   ww w. ja  v a 2s .co  m

    propertyValues.addPropertyValue(propertySource.getCacheKeyGeneratorProperty());
    propertyValues.addPropertyValue(propertySource.getCacheProviderFacadeProperty());
    propertyValues.addPropertyValue(propertySource.getCachingListenersProperty());
    propertyValues.addPropertyValue(propertySource.getCachingModelsProperty());

    registry.registerBeanDefinition(cachingInterceptorId, cachingInterceptor);
}

From source file:org.springmodules.cache.config.MethodMapInterceptorsParser.java

private void registerFlushingInterceptor(String flushingInterceptorId, BeanDefinitionRegistry registry,
        CacheSetupStrategyPropertySource propertySource) {

    MutablePropertyValues propertyValues = new MutablePropertyValues();

    RootBeanDefinition flushingInterceptor = new RootBeanDefinition(MethodMapFlushingInterceptor.class,
            propertyValues);//ww w . j  a  v a2  s. c om

    propertyValues.addPropertyValue(propertySource.getCacheProviderFacadeProperty());
    propertyValues.addPropertyValue(propertySource.getFlushingModelsProperty());

    registry.registerBeanDefinition(flushingInterceptorId, flushingInterceptor);
}

From source file:org.springmodules.cache.config.MetadataAttributesParserTests.java

private MutablePropertyValues flushingInterceptorPropertyValues() {
    MutablePropertyValues pv = new MutablePropertyValues();

    pv.addPropertyValue(propertySource.getCacheProviderFacadeProperty());
    pv.addPropertyValue(propertySource.getFlushingModelsProperty());

    return pv;//from   www.  jav  a2 s  .  c o  m
}