Add in framework for comparing on either reference or string value
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 24 Nov 2008 19:25:22 +0000 (19:25 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 24 Nov 2008 19:25:22 +0000 (19:25 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@720265 13f79535-47bb-0310-9956-ffa450edef68

modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/JdbcInterceptor.java

index 8b77e7e..6e8aeda 100644 (file)
@@ -35,6 +35,7 @@ public abstract class JdbcInterceptor implements InvocationHandler {
     protected List<InterceptorProperty> properties = null; 
     
     private JdbcInterceptor next = null;
+    private boolean useEquals = false;
 
     public JdbcInterceptor() {
     }
@@ -55,6 +56,14 @@ public abstract class JdbcInterceptor implements InvocationHandler {
         this.next = next;
     }
     
+    public boolean compare(String methodName, Method method) {
+        if (useEquals()) {
+            return methodName.equals(method.getName());
+        } else {
+            return methodName==method.getName();
+        }
+    }
+    
     /**
      * Gets called each time the connection is borrowed from the pool
      * @param parent - the connection pool owning the connection
@@ -70,4 +79,15 @@ public abstract class JdbcInterceptor implements InvocationHandler {
         this.properties = properties;
     }
     
+    public boolean getUseEquals() {
+        return useEquals();
+    }
+    
+    public boolean useEquals() {
+        return getUseEquals();
+    }
+    
+    public void setUseEquals(boolean useEquals) {
+        this.useEquals = useEquals;
+    }
 }