I have an interface ZipCodeServer
which the class ZipCodeServerImpl
implements.
I also have an interface ZipCodeList
which the class ZipCodeListImpl
implements.
One of the functions that the ZipCodeServer
interface requires is
public void initialise(ZipCodeList newlist) throws RemoteException;
Now as you can imagine, this works fine when I try to pass in a ZipCodeListImpl
to the initialise
function.
But when I try to do it via reflection (syntax is not correct, but basically I am passing in an array of only the class ZipCodeListImpl
):
aZipCodeServer.getClass().getMethod("initialise", [aZipCodeListImpl.getClass()]);
I get the error:
java.lang.NoSuchMethodException: ZipCodeServerImpl.initialise(ZipCodeListImpl)
of course because the function expects a ZipCodeList
parameter.
Thing is, this code has to be generic, so I have the list of parameters and the function name, but I have to find the function itself via reflection.