finish the JNDI function.

This commit is contained in:
septer
2012-08-11 10:57:08 +08:00
parent bae9ffccf6
commit 492fb5c7bd
6 changed files with 155 additions and 76 deletions
@@ -72,15 +72,43 @@ public class ReflectionUtils {
}
}
public static Method getObjectMethod(Object obj, String methodName, Integer id) {
public static Method getObjectMethod(Object obj, String methodName, Class<?>... parameterTypes) {
try {
return obj.getClass().getMethod(methodName, Integer.class);
return obj.getClass().getMethod(methodName, parameterTypes);
} catch (Exception e) {
LOG.warn("getObjectMethod fail:class=" + obj.getClass().getName() + " method=" + methodName, e);
return null;
}
}
public static Object callObjectMethod(Object obj, String methodName, Class<?>[] parameterTypes, Object[] parameters) {
try {
Method m = getObjectMethod(obj, methodName, parameterTypes);
return m.invoke(obj, parameters);
} catch (Exception e) {
LOG.warn("callObjectMethod fail:class=" + obj.getClass().getName() + " method=" + methodName, e);
return null;
}
}
public static Object callObjectMethod(Object obj, Method m, Object[] parameters) {
try {
return m.invoke(obj, parameters);
} catch (Exception e) {
LOG.warn("callObjectMethod fail:class=" + obj.getClass().getName() + " method=" + m.getName(), e);
return null;
}
}
public static Object callObjectMethod(Object obj, Method m) {
try {
return m.invoke(obj);
} catch (Exception e) {
LOG.warn("callObjectMethod fail:class=" + obj.getClass().getName() + " method=" + m.getName(), e);
return null;
}
}
public static Object callObjectMethod(Object obj, String methodName, Integer id) {
try {
Method m = obj.getClass().getMethod(methodName, Integer.class);
@@ -91,6 +119,24 @@ public class ReflectionUtils {
}
}
public static Method getObjectMethod(Object obj, String methodName, Integer id) {
try {
return obj.getClass().getMethod(methodName, Integer.class);
} catch (Exception e) {
LOG.warn("getObjectMethod fail:class=" + obj.getClass().getName() + " method=" + methodName, e);
return null;
}
}
public static Object callObjectMethod(Object obj, Method m, Integer id) {
try {
return m.invoke(obj, id);
} catch (Exception e) {
LOG.warn("callObjectMethod fail:class=" + obj.getClass().getName() + " method=" + m.getName(), e);
return null;
}
}
public void getTest() {
System.out.println("dd");
// return "test";