mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user