I have an annotation to which I want to pass a class as a parameter.
@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD}) @Documented public @interface PostApiRequest { Class<?> value(); } The annotation hangs on the method of the abstract parent class.
@PostApiRequest(value = ...) @Override public ResponseEntity<D> save(@RequestBody D dto) { The application does not know which heir will call the method, so I need to pass the heir class as a parameter in order to work with its annotations through reflection. Of course, I would like to see something like:
@PostApiRequest(value = this.class) //передаём класс-наследник @Override public ResponseEntity<D> save(@RequestBody D dto) { but this design does not work.
Tell me how to pass the class parameter annotations?