From b10286d4b2a98d2934ee2e16e3145deae1016454 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Mon, 16 Dec 2019 18:51:18 -0500 Subject: [PATCH] Remove some redundant generics --- .../dsl/KotlinIntegrationFlowDefinition.kt | 20 +++++++++---------- .../dsl/kotlin/test/KotlinDslTests.kt | 10 +++++----- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/spring-integration-kotlin-dsl/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt b/spring-integration-kotlin-dsl/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt index ae37cf1..f5cff38 100644 --- a/spring-integration-kotlin-dsl/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt +++ b/spring-integration-kotlin-dsl/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt @@ -81,7 +81,7 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * Inline function for [IntegrationFlowDefinition.transform] providing a `transform()` variant * with reified generic type. */ - inline fun transform(crossinline function: (P) -> T) { + inline fun transform(crossinline function: (P) -> Any) { this.delegate.transform(P::class.java) { function(it) } } @@ -89,8 +89,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * Inline function for [IntegrationFlowDefinition.transform] providing a `transform()` variant * with reified generic type. */ - inline fun transform( - crossinline function: (P) -> T, + inline fun transform( + crossinline function: (P) -> Any, crossinline configurer: (GenericEndpointSpec) -> Unit) { this.delegate.transform(P::class.java, { function(it) }) { configurer(it) } @@ -140,8 +140,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * Inline function for [IntegrationFlowDefinition.filter] providing a `filter()` variant * with reified generic type. */ - inline fun route(crossinline function: (P) -> T) { - this.delegate.route(P::class.java, Function { function(it) }) + inline fun route(crossinline function: (P) -> Any?) { + this.delegate.route(P::class.java, Function { function(it) }) } /** @@ -458,7 +458,7 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * [MessageHandler] implementation from `Namespace Factory`: * In addition accept options for the integration endpoint using [GenericEndpointSpec]. */ - fun handle(messageHandlerSpec: MessageHandlerSpec<*, H>, + fun handle(messageHandlerSpec: MessageHandlerSpec<*, H>, endpointConfigurer: (GenericEndpointSpec) -> Unit = {}) { this.delegate.handle(messageHandlerSpec, endpointConfigurer) @@ -469,7 +469,7 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * [MessageHandler] implementation. * In addition accept options for the integration endpoint using [GenericEndpointSpec]. */ - fun handle(messageHandler: H, endpointConfigurer: (GenericEndpointSpec) -> Unit = {}) { + fun handle(messageHandler: H, endpointConfigurer: (GenericEndpointSpec) -> Unit = {}) { this.delegate.handle(messageHandler, endpointConfigurer) } @@ -598,8 +598,7 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ } /** - * Populate the provided [AbstractMessageSplitter] to the current integration - * flow position. + * Populate the provided [AbstractMessageSplitter] to the current integration flow position. */ fun split(splitterMessageHandlerSpec: MessageHandlerSpec<*, S>, endpointConfigurer: (SplitterEndpointSpec) -> Unit = {}) { @@ -788,7 +787,6 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * provided `subflow` with options from [GatewayEndpointSpec]. */ fun gateway(flow: KotlinIntegrationFlowDefinition.() -> Unit) { - this.delegate.gateway(IntegrationFlow { flow(KotlinIntegrationFlowDefinition(it)) }) } @@ -922,7 +920,7 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ } /** - * Populate a [WireTap] for thecurrent channel + * Populate a [WireTap] for the current channel * with the [LoggingHandler] subscriber for the provided * [LoggingHandler.Level] logging level, logging category * and SpEL expression for the log message. diff --git a/spring-integration-kotlin-dsl/src/test/kotlin/org/springframework/integration/dsl/kotlin/test/KotlinDslTests.kt b/spring-integration-kotlin-dsl/src/test/kotlin/org/springframework/integration/dsl/kotlin/test/KotlinDslTests.kt index 980ada0..5b24774 100644 --- a/spring-integration-kotlin-dsl/src/test/kotlin/org/springframework/integration/dsl/kotlin/test/KotlinDslTests.kt +++ b/spring-integration-kotlin-dsl/src/test/kotlin/org/springframework/integration/dsl/kotlin/test/KotlinDslTests.kt @@ -159,7 +159,7 @@ class KotlinDslTests { val integrationFlow = integrationFlow(publisher) { - transform, Int>({ it.payload * 2 }) { it.id("foo") } + transform>({ it.payload * 2 }) { it.id("foo") } channel(fluxChannel) } @@ -206,7 +206,7 @@ class KotlinDslTests { @Bean fun functionFlow() = integrationFlow>({ it.beanName("functionGateway") }) { - transform { it.toUpperCase() } + transform { it.toUpperCase() } split> { it.payload } split({ it }) { it.id("splitterEndpoint") } resequence() @@ -216,9 +216,9 @@ class KotlinDslTests { @Bean fun functionFlow2() = integrationFlow> { - transform { it.toLowerCase() } + transform { it.toLowerCase() } route, Any?>({ null }) { it.defaultOutputToParentFlow() } - route, Any?> { m -> m.headers.replyChannel } + route> { m -> m.headers.replyChannel } } @Bean @@ -263,7 +263,7 @@ class KotlinDslTests { channel { it.queue("wireTapChannel") } } delay("delayGroup") { it.defaultDelay(100) } - transform { it.toUpperCase() } + transform { it.toUpperCase() } } }