In depth study of Java bytecode framework ASM
1、 What is ASM
ASM is a Java bytecode manipulation framework, which can be used to dynamically generate classes or enhance the functions of existing classes. ASM can directly generate binary class files, or dynamically change the class behavior before the class is loaded into the Java virtual machine. Java classes are stored in a strictly defined format In the class file, these class files have enough metadata to parse all the elements in the class: class name, method, attribute and Java bytecode (instruction). After reading the information from the class file, ASM can change the class behavior, analyze the class information, and even generate new classes according to user requirements.
To use the ASM framework, you need to import the ASM jar package. Download link: asm-3.2 jar。