Spring Core中一段比较优秀的逻辑

protected void applyPropertyvalues(String beanName, BeanDefinition mbd, BeanWrapper bw, PropertyValues pvs){
	if(pvs == null || pvs.isEmpty()){
		return;
	}
	MutablePropertyValues mpvs =  null;
	List<PropertyValue> original;
	if(pvs instanceof MutablePropertyValues){
		mpvs = (MutablePropertyValues)pvs;
		if(mpvs.isConverted()){
			try{
				bw.setPropertyValues(mpvs);
			}catch(Exception ex){
				throw new BeanCreateException(
					mbd.getResourceDescription(), beanName, "Error setting property values", ex);
			}
			original = mpvs.getPropertyValueList();
		} else {
			original = Arrays.asList(pvs.getPropertyValues());
		}
	}
}

你可能感兴趣的:(spring)