If you are writing a framework or libraries that generate code or interact with bytecodes, then, you need a bytecode library.
They allow you to read and modify the bytecode generated by an application. Some of the popular bytecode libraries in the Java world are javassist and Cglib Nodep.
The Javassist (JAVA programming ASSISTant) makes Java bytecode manipulation very simple. It is a class library for editing bytecodes in Java. ASM is another useful bytecode editing library.
If you are not familiar with bytecode, I suggest you check the Java Programming Masterclass for Software Developers to learn more about it.