Is it possible to just add method to class with Java Poet?

219 views Asked by At

I am wondering if is it possible to add method to class without having to rewrite whole class again using Java Poet?

Thanks

1

There are 1 answers

0
Louis Wasserman On BEST ANSWER

JavaPoet emits source code, nothing else. It can't consume the source code of an existing class.

You could emit a method with it and insert it into the body of a class some other way, but that's as good as it gets.