I have several methods with quite similar annotations. I want to extract common parts.
For example I have this:
@ApiResponse(
description = "Some description",
responseCode = "200",
content = @Content(
mediaType = "application/json",
schema = @Schema(
contains = SomeClass.class
)
))
I want to simplify it to:
@MyApiResponse(
description = "Some description",
type = SomeClass.class
)
I found @AliasFor
annotation that helps with simple cases like description
, but if I need to do more complex transformation I have no solution.
Here example of what I got for now:
@ApiResponse(
responseCode = "200"
)
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface MyApiResponse {
@AliasFor(
attribute = "description",
annotation = ApiResponse.class
)
String description();
Class<?> type();
}
My question is there any kind of processor or transformer that I can implement to fill content
attribute?
If there is no available solution I’m ready to implement it myself. In this case what class responsible for @AliasFor
processing?