This is exceedingly bad OO, but I am not trying to put this in any kind of code that will be used by anyone but the coders themselves -- it can never be called except for testing by coders.
Here is the problem I am facing: I have a series of classes that are defined externally. I cannot modify them in any way (except of course I could subclass or call them). They have a variety of names but they do not extend any superclasses (except Object), or implement any interfaces. However what I know about each of them is that they have a method called 'call'.
For testing, I am trying to write code that will call any one of these classes' call methods. But, of course, I cannot just say Object.call() because call is not defined for every Object.
Essentially, this will work:
MyClassOne classOne = new MyClassOne();
MyClassOneInput classOneInput = new MyclassOneInput();
classOne.call(classOneInput);
But this will not:
Object clazz = getClassFromElsewhere();
Object clazzInput = getClassInputFromElsewhere();
clazz.call(clazzInput).
Obviously, since Java is a strongly typed language.
BUT, for the sake of 10x faster testing for every person working on this system, can I get around that somehow and somehow use the 'call' method for any Class and any ClassInput? I have no problem if it generates an exception or breaks entirely if the wrong classes are passed.
Please help me violate Object Orientation.