From 9ae71aba95d4af7650642f912c5b034ce537e835 Mon Sep 17 00:00:00 2001 From: Dominique Villard Date: Sun, 7 May 2023 14:25:29 +0200 Subject: [PATCH] 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 --- .../main/java/ca/uhn/fhir/interceptor/api/Interceptor.java | 4 ++-- .../6_8_0/4380-allow-interceptor-annotation-on-method.yaml | 6 ++++++ pom.xml | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_8_0/4380-allow-interceptor-annotation-on-method.yaml diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Interceptor.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Interceptor.java index 618a83f30da..269cecb5c9f 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Interceptor.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Interceptor.java @@ -30,7 +30,7 @@ import java.lang.annotation.Target; * is not mandatory for interceptor classes, but is added as a marker by convention. */ @Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) +@Target({ElementType.TYPE, ElementType.METHOD}) @Inherited 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 - * 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; } diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_8_0/4380-allow-interceptor-annotation-on-method.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_8_0/4380-allow-interceptor-annotation-on-method.yaml new file mode 100644 index 00000000000..9711cf14183 --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_8_0/4380-allow-interceptor-annotation-on-method.yaml @@ -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!" diff --git a/pom.xml b/pom.xml index aeb62287be5..d8285670982 100644 --- a/pom.xml +++ b/pom.xml @@ -873,6 +873,11 @@ Aleksej Parovysnik Doctolib + + doumdoum + Dominique Villard + Doctolib +