java - Get parameter values of the calling method -


how parameter values of calling method?

i have scenario there 2 classes viz., class , class b containing 2 methods mtha(in class a) , mthb(in class b). mtha calls mthb. want know in mthb parameters have been passed mtha. logging , handling exceptions. able class name of calling class i.e class , method name calling mthb i.e mtha. stuck @ getting parameters of mtha.

thread.currentthread().getstacktrace()[1].getclassname() 

this gives me class name of calling method i.e class a.

thread.currentthread().getstacktrace()[2].getmethodname() 

this gives me method name of calling method i.e mtha.

if somehow can whole method can method parameters passed method using getparameters().

there's no easy way calling method's arguments values, (if can not change parameters of called method include , pass calling parameters values).

using apis thread provides, can static info class/method name, not runtime info arguments values. 1 way store , manage kind of info somewhere , show when required in case of logging/exception. dont think there's api in java.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -