XmlElement entity = entityMappings.addElement("entity");
entity.setAttribute("class", clazz.getCanonicalName());
entity.setAttribute("access", "PROPERTY");
entity.setAttribute("metadata-complete", "true");
BeanDescriptor beanDescriptor = new BeanDescriptorBuilder(clazz).getBeanDescriptor();
Entity e = beanDescriptor.getAnnotation(Entity.class);
if (Conditions.isNotEmpty(e.name())) {
entity.setAttribute("name", e.name());
}
Table t = beanDescriptor.getAnnotation(Table.class);
if (t != null) {
XmlElement table = entity.addElement("table");
table.setAttribute("name", t.name());
if (Conditions.isNotEmpty(t.schema())) {
table.setAttribute("schema", t.schema());
}
}
XmlElement attributes = entity.addElement("attributes");
for (PropertyDescriptor propertyDescriptor : beanDescriptor.getProperties()) {
if (propertyDescriptor.isAnnotationPresent(ManyToMany.class)) {
ManyToMany mm = propertyDescriptor.getAnnotation(ManyToMany.class);
this.addManyToMany(attributes, propertyDescriptor, mm);
} else if (propertyDescriptor.isAnnotationPresent(ManyToOne.class)) {
ManyToOne mo = propertyDescriptor.getAnnotation(ManyToOne.class);