List of usage examples for org.springframework.beans MutablePropertyValues get
@Nullable
public Object get(String propertyName)
From source file:org.kuali.rice.krad.datadictionary.MessageBeanProcessor.java
/** * Applies the text for a given message to the associated bean definition property * * @param message message instance to apply * @param beanDefinition bean definition the message should be applied to * @param beanClass class for the bean definition *///from ww w .j a v a 2 s .c om protected void applyMessageToBean(Message message, BeanDefinition beanDefinition, Class<?> beanClass) { String key = message.getKey().trim(); // if message doesn't start with path indicator, it will be an explicit key that is matched when // iterating over the property values, so we will just return in that case if (!key.startsWith(KRADConstants.MESSAGE_KEY_PATH_INDICATOR)) { return; } // if here dealing with a path key, strip off indicator and then process as a property path key = StringUtils.stripStart(key, KRADConstants.MESSAGE_KEY_PATH_INDICATOR); // list factory beans just have the one list property (with no name) if (ListFactoryBean.class.isAssignableFrom(beanClass)) { MutablePropertyValues pvs = beanDefinition.getPropertyValues(); PropertyValue propertyValue = pvs.getPropertyValueList().get(0); List<?> listValue = (List<?>) propertyValue.getValue(); applyMessageToNestedListBean(message, listValue, key); } else if (StringUtils.contains(key, ".")) { applyMessageToNestedBean(message, beanDefinition, key); } else { applyMessageTextToPropertyValue(key, message.getText(), beanDefinition); } }
From source file:org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader.java
/** * This method overrides property retrieval in the scope of the * {@code GroovyBeanDefinitionReader} to either: * <ul>/*from w w w. j av a 2s . com*/ * <li>Retrieve a variable from the bean builder's binding if it exists * <li>Retrieve a RuntimeBeanReference for a specific bean if it exists * <li>Otherwise just delegate to MetaClass.getProperty which will resolve * properties from the {@code GroovyBeanDefinitionReader} itself * </ul> */ public Object getProperty(String name) { Binding binding = getBinding(); if (binding != null && binding.hasVariable(name)) { return binding.getVariable(name); } else { if (this.namespaces.containsKey(name)) { return createDynamicElementReader(name); } if (getRegistry().containsBeanDefinition(name)) { GroovyBeanDefinitionWrapper beanDefinition = (GroovyBeanDefinitionWrapper) getRegistry() .getBeanDefinition(name).getAttribute(GroovyBeanDefinitionWrapper.class.getName()); if (beanDefinition != null) { return new GroovyRuntimeBeanReference(name, beanDefinition, false); } else { return new RuntimeBeanReference(name, false); } } // This is to deal with the case where the property setter is the last // statement in a closure (hence the return value) else if (this.currentBeanDefinition != null) { MutablePropertyValues pvs = this.currentBeanDefinition.getBeanDefinition().getPropertyValues(); if (pvs.contains(name)) { return pvs.get(name); } else { DeferredProperty dp = this.deferredProperties .get(this.currentBeanDefinition.getBeanName() + name); if (dp != null) { return dp.value; } else { return getMetaClass().getProperty(this, name); } } } else { return getMetaClass().getProperty(this, name); } } }