Modify a method using Annotations

后端 未结 5 1955
無奈伤痛
無奈伤痛 2020-12-29 10:21

How can I change what a method is doing in Java ?

I mean, I am trying to use annotations to make the following code

@Anno1(Argument = \"Option1\")
p         


        
5条回答
  •  盖世英雄少女心
    2020-12-29 10:58

    If your class extends a suitable interface, you could wrap it in a DynamicProxy, which delegates all calls to the original methods, except the call to test.

提交回复
热议问题