4379: allow interceptor annotation on methods (#4380)

* 4379: allow interceptor annotation on methods

* 4379: document order parameter when annotation set on method

* Credit for #4380

---------

Co-authored-by: James Agnew <jamesagnew@gmail.com>
This commit is contained in:
Dominique Villard 2023-05-07 14:25:29 +02:00 committed by GitHub
parent d5184a8a57
commit 9ae71aba95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 2 deletions

View File

@ -30,7 +30,7 @@ import java.lang.annotation.Target;
* is not mandatory for interceptor classes, but is added as a marker by convention. * is not mandatory for interceptor classes, but is added as a marker by convention.
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE) @Target({ElementType.TYPE, ElementType.METHOD})
@Inherited @Inherited
public @interface Interceptor { public @interface Interceptor {
@ -41,7 +41,7 @@ public @interface Interceptor {
/** /**
* The order that interceptors should be called in. Lower numbers happen before higher numbers. Default is 0 * The order that interceptors should be called in. Lower numbers happen before higher numbers. Default is 0
* and allowable values can be positive or negative or 0. * and allowable values can be positive or negative or 0. Ignored when annotation is set on a method.
*/ */
int order() default DEFAULT_ORDER; int order() default DEFAULT_ORDER;
} }

View File

@ -0,0 +1,6 @@
---
type: add
issue: 4380
title: "The `@Interceptor` annotation can now be placed at the method level. This is used only
as a marker, and does not change the behaviour or interceptors in any way. Thanks to
Dominique Villard for the pull request!"

View File

@ -873,6 +873,11 @@
<name>Aleksej Parovysnik</name> <name>Aleksej Parovysnik</name>
<organization>Doctolib</organization> <organization>Doctolib</organization>
</developer> </developer>
<developer>
<id>doumdoum</id>
<name>Dominique Villard</name>
<organization>Doctolib</organization>
</developer>
</developers> </developers>
<licenses> <licenses>