From 14f3adfcc5c225cdd557bd4c01d61dac352d1a56 Mon Sep 17 00:00:00 2001 From: snoop Date: Fri, 23 Jun 2017 20:31:17 +0900 Subject: [PATCH] fixed methodSeeker add process paramtype --- .../java/com/loafle/overflow/proxy/db/DBProxy.java | 2 +- .../com/loafle/overflow/proxy/db/MethodSeeker.java | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/loafle/overflow/proxy/db/DBProxy.java b/src/main/java/com/loafle/overflow/proxy/db/DBProxy.java index 0214881..75d1b22 100644 --- a/src/main/java/com/loafle/overflow/proxy/db/DBProxy.java +++ b/src/main/java/com/loafle/overflow/proxy/db/DBProxy.java @@ -137,7 +137,7 @@ public class DBProxy { if(params.size() > 0) { // method = dao.getClass().getMethod(methodName, Object.class); - method = MethodSeeker.getMethod(dao.getClass(), methodName); + method = MethodSeeker.getMethod(dao.getClass(), methodName, paramTypes); if (method == null) { throw new Exception("Not found method : " + methodName); } diff --git a/src/main/java/com/loafle/overflow/proxy/db/MethodSeeker.java b/src/main/java/com/loafle/overflow/proxy/db/MethodSeeker.java index 0552514..6227834 100644 --- a/src/main/java/com/loafle/overflow/proxy/db/MethodSeeker.java +++ b/src/main/java/com/loafle/overflow/proxy/db/MethodSeeker.java @@ -21,10 +21,19 @@ public class MethodSeeker { } - public static Method getMethod(Class cls, String methodName) { + public static Method getMethod(Class cls, String methodName, List paramTypes) { Method method = null; + if(paramTypes != null) { + method = MethodSeeker.getMethodType(cls, methodName, paramTypes.toArray(new Class[paramTypes.size()])); + } + + if(method != null) { + return method; + } + + for(Class type : MethodSeeker.typeList) { method = MethodSeeker.getMethodType(cls,methodName, type); if(method != null) { @@ -36,7 +45,7 @@ public class MethodSeeker { } - private static Method getMethodType(Class jpa, String methodName, Class type) { + private static Method getMethodType(Class jpa, String methodName, Class ...type) { if (jpa == null) { return null; }