Improved the performance of findAnnotation (#1177)

This commit is contained in:
Roland Praml authored and Rob Bygrave committed 2017-10-19 09:34:57 +13:00
1 parent 4a66d0be6b
commit 2263d31f46
13 files changed
+116 -145

No files matched your search

@@ -14,12 +14,12 @@ import io.ebean.config.ScalarTypeConverter;
import io.ebean.config.dbplatform.DbDefaultValue;
import io.ebean.config.dbplatform.DbEncrypt;
import io.ebean.config.dbplatform.DbEncryptFunction;
import io.ebean.util.AnnotationUtil;
import io.ebeaninternal.server.core.InternString;
import io.ebeaninternal.server.deploy.BeanProperty;
import io.ebeaninternal.server.deploy.DeployDocPropertyOptions;
import io.ebeaninternal.server.deploy.DbMigrationInfo;
import io.ebeaninternal.server.deploy.generatedproperty.GeneratedProperty;
import io.ebeaninternal.server.deploy.parse.AnnotationBase;
import io.ebeaninternal.server.el.ElPropertyValue;
import io.ebeaninternal.server.properties.BeanPropertyGetter;
import io.ebeaninternal.server.properties.BeanPropertySetter;
@@ -255,29 +255,29 @@ public class DeployBeanProperty {
if (field == null) {
return 0;
}
if (AnnotationBase.findAnnotation(field, Id.class) != null) {
if (AnnotationUtil.findAnnotation(field, Id.class) != null) {
return ID_ORDER;
} else if (AnnotationBase.findAnnotation(field, EmbeddedId.class) != null) {
} else if (AnnotationUtil.findAnnotation(field, EmbeddedId.class) != null) {
return ID_ORDER;
} else if (undirectionalShadow) {
return UNIDIRECTIONAL_ORDER;
} else if (isAuditProperty()) {
return AUDITCOLUMN_ORDER;
} else if (AnnotationBase.findAnnotation(field, Version.class) != null) {
} else if (AnnotationUtil.findAnnotation(field, Version.class) != null) {
return VERSIONCOLUMN_ORDER;
} else if (AnnotationBase.findAnnotation(field, SoftDelete.class) != null) {
} else if (AnnotationUtil.findAnnotation(field, SoftDelete.class) != null) {
return VERSIONCOLUMN_ORDER;
}
return 0;
}
private boolean isAuditProperty() {
return (AnnotationBase.findAnnotation(field, WhenCreated.class) != null
|| AnnotationBase.findAnnotation(field, WhenModified.class) != null
|| AnnotationBase.findAnnotation(field, WhoModified.class) != null
|| AnnotationBase.findAnnotation(field, WhoCreated.class) != null
|| AnnotationBase.findAnnotation(field, UpdatedTimestamp.class) != null
|| AnnotationBase.findAnnotation(field, CreatedTimestamp.class) != null);
return (AnnotationUtil.findAnnotation(field, WhenCreated.class) != null
|| AnnotationUtil.findAnnotation(field, WhenModified.class) != null
|| AnnotationUtil.findAnnotation(field, WhoModified.class) != null
|| AnnotationUtil.findAnnotation(field, WhoCreated.class) != null
|| AnnotationUtil.findAnnotation(field, UpdatedTimestamp.class) != null
|| AnnotationUtil.findAnnotation(field, CreatedTimestamp.class) != null);
}
public String getFullBeanName() {