I need to call a method via reflection. I'm able to find and call the class and the method.
But the argument/parameter is an interface, which I initialize with a class which implements this interface and I call the method with "it".
ParameterType: interface de.myapp.IParameters
GenericParameterType: interface de.myapp.IParameters
IParameters arguments = new DefaultParameter(x,y,z);
...
Object result = methodWithInterfaceparameter.invoke(myClass, arguments );
Exception:
java.lang.IllegalArgumentException: object is not an instance of declaring class
Any help is appreciated.
Aucun commentaire:
Enregistrer un commentaire