methodSeeker

  add process  paramtype
This commit is contained in:
snoop 2017-06-23 20:31:17 +09:00
parent 130170cfd5
commit 14f3adfcc5
2 changed files with 12 additions and 3 deletions

View File

@ -137,7 +137,7 @@ public class DBProxy {
if(params.size() > 0) { if(params.size() > 0) {
// method = dao.getClass().getMethod(methodName, Object.class); // method = dao.getClass().getMethod(methodName, Object.class);
method = MethodSeeker.getMethod(dao.getClass(), methodName); method = MethodSeeker.getMethod(dao.getClass(), methodName, paramTypes);
if (method == null) { if (method == null) {
throw new Exception("Not found method : " + methodName); throw new Exception("Not found method : " + methodName);
} }

View File

@ -21,10 +21,19 @@ public class MethodSeeker {
} }
public static Method getMethod(Class cls, String methodName) { public static Method getMethod(Class cls, String methodName, List<Class> paramTypes) {
Method method = null; 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) { for(Class<?> type : MethodSeeker.typeList) {
method = MethodSeeker.getMethodType(cls,methodName, type); method = MethodSeeker.getMethodType(cls,methodName, type);
if(method != null) { 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) { if (jpa == null) {
return null; return null;
} }