Java: how to get arguments passed to method that called this method?

后端 未结 6 1535
慢半拍i
慢半拍i 2020-11-28 14:25

In java, it is possible to get the class and method that called the current method (the method in which you get the StackTrace).

My question is, can I get the argume

6条回答
  •  离开以前
    2020-11-28 15:09

    I think this could be possible, because input is out of scope but isn't yet accessible for garbage collection, so the value still exists, but unfortunately I don't believe there is an default API way to access it. This could be maybe possible with a custom implemented NDC (nested diagnostic context) for the logging approach.

提交回复
热议问题