override annotation with CodeModel Java API

550 views Asked by At

How i can add @Override annotation to my method using codeModel?

JMethod update = classe.method(JMod.PUBLIC, void.class,"update");
update.annotate(?); 

i didn't find the @Override Class.

1

There are 1 answers

0
Dipak On

This is how I annotate override annotation on an overridden method using code model.

JMethod update = classe.method(JMod.PUBLIC, void.class,"update");
update .annotate(jCodeModel.ref(Override.class));

PS: : a late reply, may help other who find the same problem.