annotations

Modify a method using Annotations

↘锁芯ラ 提交于 2020-11-26 06:30:12
问题 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") public class TestClass { @Anno2 public void test() { } } Into public class TestClass { private static StaticReference z; public void test() { z.invokeToAll(); } } This is a very simplified example of what I am trying to do. Anno1 will have many possible combinations, but this is not my problem so far. My problem is how to add code to method test() I