openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r428897 - /incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
Date Fri, 04 Aug 2006 22:02:52 GMT
Author: ppoddar
Date: Fri Aug  4 15:02:51 2006
New Revision: 428897

URL: http://svn.apache.org/viewvc?rev=428897&view=rev
Log:
changed auxiliary enhancer interface

Modified:
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java?rev=428897&r1=428896&r2=428897&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java
Fri Aug  4 15:02:51 2006
@@ -536,14 +536,12 @@
         // look through all methods; this is done before any methods are added
         // so we don't need to worry about excluding synthetic methods.
         BCMethod[] methods = _pc.getDeclaredMethods();
-        Set nonEnhancedMethods = getUnenhancedMethods();
         Code code;
         for (int i = 0; i < methods.length; i++) {
             code = methods[i].getCode(false);
 
             // don't modify the methods specified by the auxiliary enhancers
-            if (code != null
-            	&& !nonEnhancedMethods.contains(methods[i].getName())) {
+            if (code != null && !skipEnhance(methods[i])) {
                 replaceAndValidateFieldAccess(code, get, true, stat);
                 replaceAndValidateFieldAccess(code, put, false, stat);
             }
@@ -2639,16 +2637,19 @@
     		auxEnhancers[i].run(_pc, _meta);
     }
     
-    private Set getUnenhancedMethods() {
-    	Set result = new HashSet();
+    /**
+     * Affirms if the given method be skipped.
+     * 
+     * @param method method to be skipped or not
+     * @return true if any of the auxiliary enhancers skips the given method.
+     */
+    private boolean skipEnhance(BCMethod method) {
     	AuxiliaryEnhancer[] auxEnhancers = getAuxiliaryEnhancers();
     	for (int i = 0; i < auxEnhancers.length; i++) {
-    		Set contrib = auxEnhancers[i].getUnenhancedMethods();
-    		if (contrib != null || !contrib.isEmpty()) {
-    			result.addAll(contrib);
-     		}
+    		if (auxEnhancers[i].skipEnhance(method))
+    			return true;
      	}
-    	return result;
+    	return false;
     }
 
     /**
@@ -3509,6 +3510,6 @@
 	public static interface AuxiliaryEnhancer
 	{
 		public void run (BCClass bc, ClassMetaData meta);
-		public Set getUnenhancedMethods();
+		public boolean skipEnhance(BCMethod m);
 	}
 }



Mime
View raw message