Coding from the hip, it would be something like:
java.lang.reflect.Method method;
try {
method = obj.getClass().getMethod(methodName, param1.class, param2.class, ..);
} catch (SecurityException e) {
// exception handling omitted for... brevity
}
catch (NoSuchMethodException e) {
// exception handling omitted for... brevity
}
The parameters identify the very specific method you need (if there are several overloaded available, if the method has no arguments, only give methodNamemethodName).
Then you invoke that method by calling
try {
method.invoke(obj, arg1, arg2,...);
} catch (IllegalArgumentException e) { // exception handling omitted for... brevity
}
catch (IllegalAccessException e) { // exception handling omitted for... brevity
}
catch (InvocationTargetException e) { // exception handling omitted for... brevity}
Again, leave out the arguments in .invoke.invoke, if you don't have any. But yeah. Read about Java Reflection