I'm documenting an api via swagger annotations. Is...
# announcements
t
I'm documenting an api via swagger annotations. Is there any way to define an annotation in one point and reuse that wherever I need? Already tried to declare a
@JvmStatic val response = @Annotation()
but it doesn't work.
c
No, annotations do not carry like that. Some frameworks (like Spring) have these kind of “meta-annotations” but that works because of the way the framework processes them, not because of anything the language is doing with them
t
So I can't avoid all of the duplicated code...
z
If the processor you're using doesn't support meta annotations, I don't think so
t
I'm using Spring and springfox, just don't know how to do it.
c
The Spring-specific annotations should be able to be set up with meta-annotations, but ones like
@JvmStatic
are processed by the Kotlin compiler, not Spring
t
So this is a no-go. Here I go to my copy paste hell.
Thank you guys!