((Map)bean).put(mapPropertyName, dataObject);
} else if(beanType == Classification.ARRAY_COLLECTION || beanType == Classification.COLLECTION_COLLECTION) {
((Collection)bean).add(dataObject);
} else if(propertySetterMethod == null) {
if(setterMethod != null) {
throw new SmooksConfigurationException("Bean [" + beanIdName + "] configuration invalid. Bean setter method [" + setterMethod + "(" + dataObject.getClass().getName() + ")] not found on type [" + beanRuntimeInfo.getPopulateType().getName() + "]. You may need to set a 'decoder' on the binding config.");
} else if(property != null) {
boolean throwException = true;
if (beanRuntimeInfo.isJAXBType() && getWiredBeanRuntimeInfo().getClassification() != BeanRuntimeInfo.Classification.NON_COLLECTION) {
// It's a JAXB collection type. If the wired in bean is created by a factory then it's most
// probable that there's no need to set the collection because the JAXB type is creating it lazily
// in the getter method. So... we're going to ignore this.
if (wireBeanId.getCreateResourceConfiguration().getParameter("beanFactory") != null) {
throwException = false;
}
}
if (throwException) {
throw new SmooksConfigurationException("Bean [" + beanIdName + "] configuration invalid. Bean setter method [" + ClassUtil.toSetterName(property) + "(" + dataObject.getClass().getName() + ")] not found on type [" + beanRuntimeInfo.getPopulateType().getName() + "]. You may need to set a 'decoder' on the binding config.");
}
}
}
if(notifyPopulate) {
BeanContextLifecycleEvent event = new BeanContextLifecycleEvent(executionContext, source, BeanLifecycle.POPULATE, beanId, bean);
executionContext.getBeanContext().notifyObservers(event);
}
} catch (IllegalAccessException e) {
throw new SmooksConfigurationException("Error invoking bean setter method [" + ClassUtil.toSetterName(property) + "] on bean instance class type [" + bean.getClass() + "].", e);
} catch (InvocationTargetException e) {
throw new SmooksConfigurationException("Error invoking bean setter method [" + ClassUtil.toSetterName(property) + "] on bean instance class type [" + bean.getClass() + "].", e);
}
}