From f4809aa9974c1d0d276298d37fa0535a98c94cbe Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Mon, 4 Jun 2018 17:29:44 -0400 Subject: [PATCH] INT-4424: No @Inherited on method annotations JIRA: https://jira.spring.io/browse/INT-4424 * Polishing for `phase` JavaDocs --- .../integration/annotation/Aggregator.java | 8 ++++---- .../integration/annotation/BridgeFrom.java | 20 +++++++++++++------ .../integration/annotation/BridgeTo.java | 20 +++++++++++++------ .../integration/annotation/Filter.java | 10 +++++----- .../integration/annotation/Gateway.java | 4 +--- .../annotation/InboundChannelAdapter.java | 18 +++++++++++------ .../integration/annotation/Role.java | 7 +++---- .../integration/annotation/Router.java | 12 +++++------ .../annotation/ServiceActivator.java | 4 +--- .../integration/annotation/Splitter.java | 10 +++++----- .../integration/annotation/Transformer.java | 12 +++++------ 11 files changed, 69 insertions(+), 56 deletions(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Aggregator.java b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Aggregator.java index 32ada0787f..9210051f9f 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Aggregator.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Aggregator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ import java.lang.annotation.Target; * @author Oleg Zhurakousky * @author Artem Bilan */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) +@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE }) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface Aggregator { @@ -93,7 +93,7 @@ public @interface Aggregator { /** * Specify a {@link org.springframework.context.SmartLifecycle} {@code phase} option. - * Defaults {@code 0} for {@link org.springframework.integration.endpoint.PollingConsumer} + * Defaults {@code Integer.MAX_VALUE / 2} for {@link org.springframework.integration.endpoint.PollingConsumer} * and {@code Integer.MIN_VALUE} for {@link org.springframework.integration.endpoint.EventDrivenConsumer}. * Can be specified as 'property placeholder', e.g. {@code ${foo.phase}}. * @return the {@code SmartLifecycle} phase. @@ -106,6 +106,6 @@ public @interface Aggregator { * This attribute is an {@code array} just to allow an empty default (no poller). * Only one {@link Poller} element is allowed. */ - Poller[] poller() default {}; + Poller[] poller() default { }; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/annotation/BridgeFrom.java b/spring-integration-core/src/main/java/org/springframework/integration/annotation/BridgeFrom.java index 2dd3517121..13e2233e8f 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/annotation/BridgeFrom.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/annotation/BridgeFrom.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 the original author or authors. + * Copyright 2014-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ package org.springframework.integration.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -37,13 +36,14 @@ import java.lang.annotation.Target; * is used as the {@code outputChannel} of the {@link org.springframework.integration.handler.BridgeHandler}. * * @author Artem Bilan + * * @since 4.0 */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) +@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE }) @Retention(RetentionPolicy.RUNTIME) -@Inherited @Documented public @interface BridgeFrom { + /** * @return the inbound channel name to receive message for the * {@link org.springframework.integration.handler.BridgeHandler} @@ -56,7 +56,14 @@ public @interface BridgeFrom { */ String autoStartup() default "true"; - String phase() default "0"; + /** + * Specify a {@link org.springframework.context.SmartLifecycle} {@code phase} option. + * Defaults {@code Integer.MAX_VALUE / 2} for {@link org.springframework.integration.endpoint.PollingConsumer} + * and {@code Integer.MIN_VALUE} for {@link org.springframework.integration.endpoint.EventDrivenConsumer}. + * Can be specified as 'property placeholder', e.g. {@code ${foo.phase}}. + * @return the {@code SmartLifecycle} phase. + */ + String phase() default ""; /** * @return the {@link Poller} options for a polled endpoint @@ -64,5 +71,6 @@ public @interface BridgeFrom { * This attribute is an {@code array} just to allow an empty default (no poller). * Only one {@link Poller} element is allowed. */ - Poller[] poller() default {}; + Poller[] poller() default { }; + } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/annotation/BridgeTo.java b/spring-integration-core/src/main/java/org/springframework/integration/annotation/BridgeTo.java index 04b1d3cb8d..5afca78dff 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/annotation/BridgeTo.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/annotation/BridgeTo.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 the original author or authors. + * Copyright 2014-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ package org.springframework.integration.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -42,13 +41,14 @@ import java.lang.annotation.Target; * If no output channel is provided and no reply-channel exists, an exception is thrown. * * @author Artem Bilan + * * @since 4.0 */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) +@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE }) @Retention(RetentionPolicy.RUNTIME) -@Inherited @Documented public @interface BridgeTo { + /** * @return the outbound channel name to send the message to * {@link org.springframework.integration.handler.BridgeHandler}. @@ -63,7 +63,14 @@ public @interface BridgeTo { */ String autoStartup() default "true"; - String phase() default "0"; + /** + * Specify a {@link org.springframework.context.SmartLifecycle} {@code phase} option. + * Defaults {@code Integer.MAX_VALUE / 2} for {@link org.springframework.integration.endpoint.PollingConsumer} + * and {@code Integer.MIN_VALUE} for {@link org.springframework.integration.endpoint.EventDrivenConsumer}. + * Can be specified as 'property placeholder', e.g. {@code ${foo.phase}}. + * @return the {@code SmartLifecycle} phase. + */ + String phase() default ""; /** * @return the {@link org.springframework.integration.annotation.Poller} options for a polled endpoint @@ -71,5 +78,6 @@ public @interface BridgeTo { * This attribute is an {@code array} just to allow an empty default (no poller). * Only one {@link org.springframework.integration.annotation.Poller} element is allowed. */ - Poller[] poller() default {}; + Poller[] poller() default { }; + } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Filter.java b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Filter.java index 25ae75cf7b..a280d9c317 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Filter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Filter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ import java.lang.annotation.Target; * @author Artem Bilan * @since 2.0 */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) +@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE }) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface Filter { @@ -80,7 +80,7 @@ public @interface Filter { * Only the handler is advised, not the downstream flow. * @return the advice chain. */ - String[] adviceChain() default {}; + String[] adviceChain() default { }; /** * When {@code true} (default) any discard action (and exception thrown) will occur @@ -115,7 +115,7 @@ public @interface Filter { /** * Specify a {@link org.springframework.context.SmartLifecycle} {@code phase} option. - * Defaults {@code 0} for {@link org.springframework.integration.endpoint.PollingConsumer} + * Defaults {@code Integer.MAX_VALUE / 2} for {@link org.springframework.integration.endpoint.PollingConsumer} * and {@code Integer.MIN_VALUE} for {@link org.springframework.integration.endpoint.EventDrivenConsumer}. * Can be specified as 'property placeholder', e.g. {@code ${foo.phase}}. * @return the {@code SmartLifecycle} phase. @@ -128,6 +128,6 @@ public @interface Filter { * This attribute is an {@code array} just to allow an empty default (no poller). * Only one {@link Poller} element is allowed. */ - Poller[] poller() default {}; + Poller[] poller() default { }; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Gateway.java b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Gateway.java index 2f168ac892..f08dde2fbd 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Gateway.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Gateway.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ package org.springframework.integration.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -59,7 +58,6 @@ import java.lang.annotation.Target; */ @Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE }) @Retention(RetentionPolicy.RUNTIME) -@Inherited @Documented public @interface Gateway { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/annotation/InboundChannelAdapter.java b/spring-integration-core/src/main/java/org/springframework/integration/annotation/InboundChannelAdapter.java index bc4bfe1802..e2be8acafe 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/annotation/InboundChannelAdapter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/annotation/InboundChannelAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ package org.springframework.integration.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -46,11 +45,11 @@ import org.springframework.core.annotation.AliasFor; * * @author Artem Bilan * @author Gary Russell + * * @since 4.0 */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) +@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE }) @Retention(RetentionPolicy.RUNTIME) -@Inherited @Documented public @interface InboundChannelAdapter { @@ -74,7 +73,14 @@ public @interface InboundChannelAdapter { */ String autoStartup() default "true"; - String phase() default "0"; + /** + * Specify a {@link org.springframework.context.SmartLifecycle} {@code phase} option. + * Defaults {@code Integer.MAX_VALUE / 2} for {@link org.springframework.integration.endpoint.PollingConsumer} + * and {@code Integer.MIN_VALUE} for {@link org.springframework.integration.endpoint.EventDrivenConsumer}. + * Can be specified as 'property placeholder', e.g. {@code ${foo.phase}}. + * @return the {@code SmartLifecycle} phase. + */ + String phase() default ""; /** * @return the {@link org.springframework.integration.annotation.Poller} options for a polled endpoint @@ -83,6 +89,6 @@ public @interface InboundChannelAdapter { * Only one {@link org.springframework.integration.annotation.Poller} element is allowed. * NOTE: a {@link Poller} here has {@link Poller#maxMessagesPerPoll()} set to 1 by default. */ - Poller[] poller() default {}; + Poller[] poller() default { }; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Role.java b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Role.java index b5ddfbcf93..ad92079c3f 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Role.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Role.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ package org.springframework.integration.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -28,11 +27,11 @@ import java.lang.annotation.Target; * a group. See {@code SmartLifecycleRoleController}. * * @author Gary Russell + * * @since 4.2 */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) +@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE }) @Retention(RetentionPolicy.RUNTIME) -@Inherited @Documented public @interface Role { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Router.java b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Router.java index 30c7e70a20..c27735a046 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Router.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Router.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ package org.springframework.integration.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -45,9 +44,8 @@ import java.lang.annotation.Target; * @author Mark Fisher * @author Artem Bilan */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) +@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE }) @Retention(RetentionPolicy.RUNTIME) -@Inherited @Documented public @interface Router { @@ -71,7 +69,7 @@ public @interface Router { * @return the channelMappings. * @see org.springframework.integration.router.AbstractMappingMessageRouter#setChannelMapping(String, String) */ - String[] channelMappings() default {}; + String[] channelMappings() default { }; /** * Specify a prefix to be added to each channel name prior to resolution. @@ -141,7 +139,7 @@ public @interface Router { /** * Specify a {@link org.springframework.context.SmartLifecycle} {@code phase} option. - * Defaults {@code 0} for {@link org.springframework.integration.endpoint.PollingConsumer} + * Defaults {@code Integer.MAX_VALUE / 2} for {@link org.springframework.integration.endpoint.PollingConsumer} * and {@code Integer.MIN_VALUE} for {@link org.springframework.integration.endpoint.EventDrivenConsumer}. * Can be specified as 'property placeholder', e.g. {@code ${foo.phase}}. * @return the {@code SmartLifecycle} phase. @@ -154,6 +152,6 @@ public @interface Router { * This attribute is an {@code array} just to allow an empty default (no poller). * Only one {@link Poller} element is allowed. */ - Poller[] poller() default {}; + Poller[] poller() default { }; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/annotation/ServiceActivator.java b/spring-integration-core/src/main/java/org/springframework/integration/annotation/ServiceActivator.java index 7d5fddabe9..5ee7928cf7 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/annotation/ServiceActivator.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/annotation/ServiceActivator.java @@ -18,7 +18,6 @@ package org.springframework.integration.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -45,7 +44,6 @@ import java.lang.annotation.Target; */ @Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE }) @Retention(RetentionPolicy.RUNTIME) -@Inherited @Documented public @interface ServiceActivator { @@ -104,7 +102,7 @@ public @interface ServiceActivator { /** * Specify a {@link org.springframework.context.SmartLifecycle} {@code phase} option. - * Defaults {@code 0} for {@link org.springframework.integration.endpoint.PollingConsumer} + * Defaults {@code Integer.MAX_VALUE / 2} for {@link org.springframework.integration.endpoint.PollingConsumer} * and {@code Integer.MIN_VALUE} for {@link org.springframework.integration.endpoint.EventDrivenConsumer}. * Can be specified as 'property placeholder', e.g. {@code ${foo.phase}}. * @return the {@code SmartLifecycle} phase. diff --git a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Splitter.java b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Splitter.java index 926718b5f8..2ea0426b70 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Splitter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Splitter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,7 +42,7 @@ import java.lang.annotation.Target; * @author Gary Russell * @author Artem Bilan */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) +@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE }) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface Splitter { @@ -78,7 +78,7 @@ public @interface Splitter { * Only the handler is advised, not the downstream flow. * @return the advice chain. */ - String[] adviceChain() default {}; + String[] adviceChain() default { }; /** * Specify the maximum amount of time in milliseconds to wait when sending a reply @@ -104,7 +104,7 @@ public @interface Splitter { /** * Specify a {@link org.springframework.context.SmartLifecycle} {@code phase} option. - * Defaults {@code 0} for {@link org.springframework.integration.endpoint.PollingConsumer} + * Defaults {@code Integer.MAX_VALUE / 2} for {@link org.springframework.integration.endpoint.PollingConsumer} * and {@code Integer.MIN_VALUE} for {@link org.springframework.integration.endpoint.EventDrivenConsumer}. * Can be specified as 'property placeholder', e.g. {@code ${foo.phase}}. * @return the {@code SmartLifecycle} phase. @@ -117,6 +117,6 @@ public @interface Splitter { * This attribute is an {@code array} just to allow an empty default (no poller). * Only one {@link Poller} element is allowed. */ - Poller[] poller() default {}; + Poller[] poller() default { }; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Transformer.java b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Transformer.java index f5fbe4a57d..56aca00b17 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Transformer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Transformer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ package org.springframework.integration.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -31,9 +30,8 @@ import java.lang.annotation.Target; * @author Gary Russell * @author Artem Bilan */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) +@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE }) @Retention(RetentionPolicy.RUNTIME) -@Inherited @Documented public @interface Transformer { @@ -56,7 +54,7 @@ public @interface Transformer { * Only the handler is advised, not the downstream flow. * @return the advice chain. */ - String[] adviceChain() default {}; + String[] adviceChain() default { }; /** * Specify the maximum amount of time in milliseconds to wait when sending a reply @@ -82,7 +80,7 @@ public @interface Transformer { /** * Specify a {@link org.springframework.context.SmartLifecycle} {@code phase} option. - * Defaults {@code 0} for {@link org.springframework.integration.endpoint.PollingConsumer} + * Defaults {@code Integer.MAX_VALUE / 2} for {@link org.springframework.integration.endpoint.PollingConsumer} * and {@code Integer.MIN_VALUE} for {@link org.springframework.integration.endpoint.EventDrivenConsumer}. * Can be specified as 'property placeholder', e.g. {@code ${foo.phase}}. * @return the {@code SmartLifecycle} phase. @@ -95,6 +93,6 @@ public @interface Transformer { * This attribute is an {@code array} just to allow an empty default (no poller). * Only one {@link Poller} element is allowed. */ - Poller[] poller() default {}; + Poller[] poller() default { }; }