Retrieving parameter values through reflection

后端 未结 2 1175
陌清茗
陌清茗 2021-01-21 15:04

I am trying to come up with a design for a method that takes another method as a parameter and retrieves the parameter values of the method passed. How can this be done? I\'ve t

相关标签:
2条回答
  • 2021-01-21 15:30

    Method.getParameterTypes

    http://download.oracle.com/javase/1.4.2/docs/api/java/lang/reflect/Method.html#getParameterTypes%28%29

    0 讨论(0)
  • 2021-01-21 15:47

    You can't really get the values passed as parameters like this.

    You can make your own Proxy and from there capture parameters before calling the right method. Or with aspect you could get the parameters value directly when the method is called.

    0 讨论(0)
提交回复
热议问题