Remove reading mapping annotations from "Getters" with associated refactoring for performance (#1971)

* #1970 - Change test code only moving mapping annotations to fields

First step in remove support for mapping annotations on "Getters" (so field only target for mapping annotations)

* #1970 - Remove reading mapping annotations from "Getters"

* #1970 - Refactor to use simple annotation lookup where possible

* #1970 - Remove GenerationType.TABLE and SequenceGenerator from type/class

* #1970 - Refactor meta annotation reading

* #1970 - Read @Aggregation as a meta annotation
This commit is contained in:
Rob Bygrave
2020-03-09 16:09:41 +13:00
committed by GitHub
parent 7692d9782a
commit a861e8bdcc
33 changed files with 590 additions and 680 deletions
@@ -8,7 +8,6 @@ import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Inheritance;
import java.lang.annotation.Annotation;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -110,11 +109,11 @@ public class DeployInherit {
info.setParent(parent);
}
Inheritance ia = AnnotationUtil.findAnnotationRecursive(cls, Inheritance.class);
Inheritance ia = AnnotationUtil.typeGet(cls, Inheritance.class);
if (ia != null) {
ia.strategy();
}
DiscriminatorColumn da = AnnotationUtil.findAnnotationRecursive(cls, DiscriminatorColumn.class);
DiscriminatorColumn da = AnnotationUtil.typeGet(cls, DiscriminatorColumn.class);
if (da != null) {
// lowercase the discriminator column for RawSql and JSON
info.setColumnName(da.name().toLowerCase());
@@ -124,7 +123,7 @@ public class DeployInherit {
}
if (!info.isAbstract()) {
DiscriminatorValue dv = AnnotationUtil.findAnnotation(cls, DiscriminatorValue.class); // do not search recursive
DiscriminatorValue dv = AnnotationUtil.get(cls, DiscriminatorValue.class); // do not search recursive
if (dv != null) {
info.setDiscriminatorValue(dv.value());
} else {
@@ -144,17 +143,7 @@ public class DeployInherit {
}
private boolean isInheritanceClass(Class<?> cls) {
while (true) {
if (cls.equals(Object.class)) {
return false;
}
Annotation a = AnnotationUtil.findAnnotationRecursive(cls, Inheritance.class);
if (a != null) {
return true;
}
// search up the inheritance heirarchy
cls = cls.getSuperclass();
}
return AnnotationUtil.typeHas(cls, Inheritance.class);
}
}