Author: aadamchik
Date: Wed Dec 8 13:45:47 2010
New Revision: 1043417
URL: http://svn.apache.org/viewvc?rev=1043417&view=rev
Log:
CAY-1509 Lifecycle event annotations support
No need to check Inherited annotation by hand... Java does it for us
Modified:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/LifecycleCallbackRegistry.java
Modified:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/LifecycleCallbackRegistry.java
URL:
http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/LifecycleCallbackRegistry.java?rev=1043417&r1=1043416&r2=1043417&view=diff
==============================================================================
---
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/LifecycleCallbackRegistry.java
(original)
+++
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/reflect/LifecycleCallbackRegistry.java
Wed Dec 8 13:45:47 2010
@@ -19,7 +19,6 @@
package org.apache.cayenne.reflect;
import java.lang.annotation.Annotation;
-import java.lang.annotation.Inherited;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
@@ -381,7 +380,6 @@ public class LifecycleCallbackRegistry {
if (entities == null) {
entities = new ArrayList<Class<?>>();
- boolean inherited = type.isAnnotationPresent(Inherited.class);
for (ObjEntity entity : entityResolver.getObjEntities()) {
Class<?> entityType;
try {
@@ -391,17 +389,10 @@ public class LifecycleCallbackRegistry {
throw new CayenneRuntimeException("Class not found: "
+ entity.getClassName(), e);
}
-
- Class<?> entityTypeOrSupertype = entityType;
- do {
- if (entityTypeOrSupertype.isAnnotationPresent(type)) {
- entities.add(entityType);
- break;
- }
-
- entityTypeOrSupertype =
entityTypeOrSupertype.getSuperclass();
-
- } while (inherited && entityTypeOrSupertype != null);
+
+ if (entityType.isAnnotationPresent(type)) {
+ entities.add(entityType);
+ }
}
entitiesByAnnotation.put(type.getName(), entities);