Java 8 - how to access object and method encapsulated as lambda

前端 未结 3 1540
情歌与酒
情歌与酒 2021-01-02 20:42

In Java you can \"capture\" a \"method call on object\" as a Runnable, as in belows example.

Later, having access to this instance of Runnable, is it possible to act

3条回答
  •  猫巷女王i
    2021-01-02 21:15

    With reflection, it is not possible to get local variables and method parameter values. Instead you can use AOP to intercept the method call and inspect the parameters.

提交回复
热议问题