vendredi 31 juillet 2015

standard output stream of void method.invoke()

How can I get the standard output stream of a void method that I invoked as a string?

This is what I have at the moment:

if(method.getGenericReturnType().toString().equals("void"))
       method.invoke(instance, param);
else{
       Object obj = method.invoke(instance, param);
       System.out.println(obj.toString());
}

If i try to do the same to a void method, i get a null exception.





Aucun commentaire:

Enregistrer un commentaire