I am working on a generic printer utility that prints whatever object might come along as long it presents an invokePrint() method. The context asks me for a PrintDialogEditor object I get through reflection in the following manner. I tried all sorts of paremeter for that invoke method along that troubleshooting offered through Oracle IllegalArgumentException from Method.invoke() but I can't get passed that last line. My question: Does the Reflection API foresee operations on generic objects at all?
PrintDialogEditor pde = null;
U editor = au.getEditor(entity);
if(hasInvokePrint(editor)) {
Method m = editor.getClass().getMethod("invokePrint");
pde = (PrintDialogEditor) m.invoke(editor); // this line fails
I have been debugging along the Oracle troubleshooting for using the Method.invoke() method.
Aucun commentaire:
Enregistrer un commentaire