Can anyone show me how to add annotation to a field using JavaPoet?
All examples I've managed to explore so far are about adding annotations to the classes and methods.
It looks like I'm missing something pretty straighforward here.
Hooray, I've figured it out, so might be it would be a help for someone else:
typeSpecBuilder
.addField(
FieldSpec.builder(<SomeClass>, <name>)
.addAnnotation(<AnnotationClass>)
.addModifiers(Modifier.PUBLIC)
.build()
);