/**
* Returns a property value for the bean with the given name from the dictionary.
*
* @param beanName id or name for the bean definition
* @param propertyName name of the property to retrieve, must be a valid property configured on
* the bean definition
* @return Object property value for property
*/
public Object getDictionaryBeanProperty(String beanName, String propertyName) {
Object bean = ddBeans.getSingleton(beanName);
if (bean != null) {
return ObjectPropertyUtils.getPropertyValue(bean, propertyName);
}
BeanDefinition beanDefinition = ddBeans.getMergedBeanDefinition(beanName);
if (beanDefinition == null) {
throw new RuntimeException("Unable to get bean for bean name: " + beanName);
}
PropertyValues pvs = beanDefinition.getPropertyValues();
if (pvs.contains(propertyName)) {
PropertyValue propertyValue = pvs.getPropertyValue(propertyName);
Object value;
if (propertyValue.isConverted()) {
value = propertyValue.getConvertedValue();
} else if (propertyValue.getValue() instanceof String) {
String unconvertedValue = (String) propertyValue.getValue();
Scope scope = ddBeans.getRegisteredScope(beanDefinition.getScope());
BeanExpressionContext beanExpressionContext = new BeanExpressionContext(ddBeans, scope);
value = ddBeans.getBeanExpressionResolver().evaluate(unconvertedValue, beanExpressionContext);
} else {
value = propertyValue.getValue();
}
return value;
}
return null;
}
DataDictionary.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:rice
作者:
评论列表
文章目录