RULE trace method entry and exit CLASS com.example.MyClass METHOD foo AT ENTRY,EXIT IF true DO traceln("Entering or exiting method foo!") ENDRULE $ bminstall.sh $ bminstall.bat $ java -javaagent:path/to/byteman.jar=script:/path/to/your/script.btm com.example.Main package com.example; public class MyClass { public void foo() { System.out.println("Hello from foo!"); } } RULE modify foo method CLASS com.example.MyClass METHOD foo AT ENTRY IF true DO traceln("Modifying foo method!") DO REBIND $0.setName("Modified foo method!") ENDRULE $ bminstall.sh $ bminstall.bat $ java -javaagent:path/to/byteman.jar=script:/path/to/example.btm com.example.MyClass Modifying foo method! Hello from Modified foo method!


上一篇:
下一篇:
切换中文