Java reflection helps somewhat, but there is a missing piece of data. Also, reflection typically throws MANY checked exceptions that you will need to catch. (I included a list after the code)
What is the object that holds the "doSomething" methods? In this example, I use the variable name "someObject" to represent the object holding the "doSomething" method. You need to substitute this for something more sensical.
Also, just a warning, this will not catch derived types, so if the method definition doesn't match the type given, you will get a method not found exception.
//now I want to call doSomething method
// (1)
Method method = someObject.getClass.getMethod("doSomething",new Class[] {o.getClass()});
method.invoke(someObject, new Object[] {o});
// (2)
Warning: You need to deal with the following exceptions when using reflection this way: (This is not an unusual list incidentally, reflection is typically very noisy in terms of exceptions)
NoSuchMethodException - if a matching method is not found or if the name is "<init>"or "<clinit>".
NullPointerException - if name is null
SecurityException - if access to the information is denied.
IllegalAccessException - if this Method object enforces Java language access control and the underlying method is inaccessible.
IllegalArgumentException - if the method is an instance method and the specified object argument is not an instance of the class or interface declaring the underlying method (or of a subclass or implementor thereof); if the number of actual and formal parameters differ; if an unwrapping conversion for primitive arguments fails; or if, after possible unwrapping, a parameter value cannot be converted to the corresponding formal parameter type by a method invocation conversion.
InvocationTargetException - if the underlying method throws an exception.
NullPointerException - if the specified object is null and the method is an instance method.
ExceptionInInitializerError - if the initialization provoked by this method fails.