I'm trying to recreate a class using JavaPoet. What's the best way to do this?
Basically, I want to generate another class with one method with appended statements.
JavaPoet can’t easily modify existing code. This is potentially quite difficult because features like import resolution rely on parsing types properly.
You might be able to cheat by emitting a new file and then using a StringBuilder to manually concatenate imports and members. You might need some regexes.