D
David Smith
Hello,
I'd like to write a detailed log following an Exception, that includes
listing the field values of each parameter that was in the list of
actual parameters.
For example, imagine the following methods:
public void callingMethod() {
faultyMethod ("Hello", 99);
}
public void faultyMethod (String s, int i) {
throw new Exception();
}
While I'm in this method body, can I use reflection to get a
collection of all the actual parameters somehow, so that I can put a
String representation of them as the message into the Exception? This
would be easier than for each method manually writing the required
code to process the actual parameters.
So in this case, the message would be something like "s=Hello – i=99".
User-defined objects can easily be introspected and the fields
printed.
Thanks,
David.
I'd like to write a detailed log following an Exception, that includes
listing the field values of each parameter that was in the list of
actual parameters.
For example, imagine the following methods:
public void callingMethod() {
faultyMethod ("Hello", 99);
}
public void faultyMethod (String s, int i) {
throw new Exception();
}
While I'm in this method body, can I use reflection to get a
collection of all the actual parameters somehow, so that I can put a
String representation of them as the message into the Exception? This
would be easier than for each method manually writing the required
code to process the actual parameters.
So in this case, the message would be something like "s=Hello – i=99".
User-defined objects can easily be introspected and the fields
printed.
Thanks,
David.