gropapa
gropapa

Reputation: 577

javapoet how to specify current generated instance as return result

I am writing an annotation Processor that generates Agenerated class from an annotated A class. I would like to be able to do something like

AgeneratedInst.getFoo().getBar()...

In order to do so I have to specify the return type which is the current class I am writing... Is there a way to do so?

Upvotes: 1

Views: 382

Answers (1)

gropapa
gropapa

Reputation: 577

I just figured out, maybe it's kinda weird but it works. I just have to specify a TypeName like this:

String generatedName = "Agenerated";
ClassName className = ClassName.get("", classsName);

then I use it as a return type for a method and it's ok

Upvotes: 2

Related Questions