protected void doBeanConfigure(BeanDefinitionBase bd, Object bean) throws Throwable { if(null != bd && bd.isConfigurable()) { BeanType bt = null == bd ? BeanType.of(bean.getClass()) : bd.getBeanClassType(); beanConfigurator.configure(bean, bt, bd.getConfigurationPrefix()); } }
protected void doBeanSetProperties(BeanDefinitionBase bd,Object bean){ BeanType beanType = bd.getBeanClassType(); for(PropertyDefinition pd : bd.getProperties()){ BeanProperty bp = beanType.getProperty(pd.getName()); if(null == bp){ throw new BeanCreationException("No such property '" + pd.getName() + " in bean " + bd); } bp.setValue(bean, doResolveValue(bd, pd.getValueDefinition(), pd.getDefaultValue())); } }
protected void doBeanInjection(BeanDefinitionBase bd,Object bean) throws Throwable { BeanFactory factory = null != beanFactory ? beanFactory : this; BeanType bt = null == bd ? null : bd.getBeanClassType(); if(null == bt) { bt = BeanType.of(bean.getClass());
protected void readProperty(BeanContainer container, XmlReader reader, LoaderContext context, BeanDefinitionBase bean) { if(!testIfAttributes(container, reader)) { reader.nextToEndElement(); return; } PropertyDefinition prop = new PropertyDefinition(); prop.setName(reader.getRequiredAttribute(NAME_ATTRIBUTE)); prop.setDefaultValue(reader.getAttribute(DEFAULT_VALUE_ATTRIBUTE)); prop.setValueDefinition(readValue(container, reader, context, PROPERTY_ELEMENT)); prop.setProperty(bean.getBeanClassType().getProperty(prop.getName())); if (null == prop.getProperty()) { throw new BeanDefinitionException("property '" + prop.getName() + "' not found in bean class '" + bean.getBeanClass().getName() + ", source : " + reader.getSource()); } if (null == prop.getValueDefinition()) { throw new BeanDefinitionException("property '" + prop.getName() + "' must define a value, check source : " + bean.getSource()); } bean.addProperty(prop); }