if(beanDefinition.getBeanClassName() != null){
//with CLASS_ATTRIBUTE
interfaces = beanDefinition.getBeanClass().getInterfaces();
if(! GenericEntityDao.class.isAssignableFrom(beanDefinition.getBeanClass()))
throw new BeanCreationException("{} is not a valid GenericEntityDao bean.", element.getAttribute(ID_ATTRIBUTE));
//override abstract method
Method[] methods = beanDefinition.getBeanClass().getMethods();
for (Method method : methods) {
if (Modifier.isAbstract(method.getModifiers())) {
beanDefinition.getMethodOverrides().addOverride(
new ReplaceOverride(method.getName(), null));
}
}
}else if(element.hasAttribute(INTERFACE_ATTRIBUTE)){
try {
Class<?> iClazz = ClassUtils.forName(element.getAttribute(INTERFACE_ATTRIBUTE), getClass().getClassLoader());
interfaces = new Class<?>[]{iClazz, ModelClassSupport.class};
if (GenericEntityDao.class.isAssignableFrom(iClazz)) {
beanDefinition = new RootBeanDefinition(SimpleModelClassSupport.class);
beanDefinition.getPropertyValues().addPropertyValue("modelClass",getGenericModelClass(iClazz));
}else{
throw new BeanCreationException("{} is not a valid GenericEntityDao Interface.", element.getAttribute(ID_ATTRIBUTE));
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
throw new BeanCreationException("Loxia bean definition error with name:" + element.getAttribute(ID_ATTRIBUTE));
} catch (LinkageError e) {
e.printStackTrace();
throw new BeanCreationException("Loxia bean definition error with name:" + element.getAttribute(ID_ATTRIBUTE));
}
}else{
throw new BeanCreationException("Loxia bean definition error with name:" + element.getAttribute(ID_ATTRIBUTE));
}
AbstractBeanDefinition rootDefinition = new GenericBeanDefinition();
rootDefinition.setParentName("parentGenericDaoProxy");
rootDefinition.getPropertyValues().addPropertyValue("proxyInterfaces",interfaces);