boolean isPropertSpecified = (DomUtils.getAttributeValue(element, "property") != null);
boolean isSetterMethodSpecified = (DomUtils.getAttributeValue(element, "setterMethod") != null);
String bindingType = DomUtils.getName(element);
if(isPropertSpecified && isSetterMethodSpecified) {
throw new SmooksConfigurationException("'" + bindingType + "' binding specifies a 'property' and a 'setterMethod' attribute. Only one of both may be set.");
}
if(isPropertSpecified && beanType == BeanType.COLLECTION) {
throw new SmooksConfigurationException("'" + bindingType + "' binding specifies a 'property' attribute. This is not valid for a Collection target.");
}
if(isPropertSpecified && beanType == BeanType.ARRAY) {
throw new SmooksConfigurationException("'" + bindingType + "' binding specifies a 'property' attribute. This is not valid for an Array target.");
}
if(isSetterMethodSpecified && beanType == BeanType.COLLECTION) {
throw new SmooksConfigurationException("'" + bindingType + "' binding specifies a 'setterMethod' attribute. This is not valid for a Collection target.");
}
if(isSetterMethodSpecified && beanType == BeanType.ARRAY) {
throw new SmooksConfigurationException("'" + bindingType + "' binding specifies a 'setterMethod' attribute. This is not valid for an Array target.");
}
if(!isPropertSpecified && !isSetterMethodSpecified && beanType == BeanType.OTHER) {
throw new SmooksConfigurationException("'" + bindingType + "' binding for bean class '" + getBeanTypeName(element) + "' must specify a 'property' or 'setterMethod' attribute.");
}
}