diff --git a/spring-beans/src/main/kotlin/org/springframework/beans/factory/BeanFactoryExtensions.kt b/spring-beans/src/main/kotlin/org/springframework/beans/factory/BeanFactoryExtensions.kt index 0b5fd1b6a6..67c6bae77a 100644 --- a/spring-beans/src/main/kotlin/org/springframework/beans/factory/BeanFactoryExtensions.kt +++ b/spring-beans/src/main/kotlin/org/springframework/beans/factory/BeanFactoryExtensions.kt @@ -16,7 +16,6 @@ package org.springframework.beans.factory - /** * Extension for [BeanFactory.getBean] providing a `getBean()` variant. * diff --git a/spring-beans/src/main/kotlin/org/springframework/beans/factory/ListableBeanFactoryExtensions.kt b/spring-beans/src/main/kotlin/org/springframework/beans/factory/ListableBeanFactoryExtensions.kt index 48aa916262..76c2f4db9a 100644 --- a/spring-beans/src/main/kotlin/org/springframework/beans/factory/ListableBeanFactoryExtensions.kt +++ b/spring-beans/src/main/kotlin/org/springframework/beans/factory/ListableBeanFactoryExtensions.kt @@ -17,13 +17,15 @@ package org.springframework.beans.factory /** - * Extension for [ListableBeanFactory.getBeanNamesForType] providing a `getBeanNamesForType()` variant. + * Extension for [ListableBeanFactory.getBeanNamesForType] providing a + * `getBeanNamesForType()` variant. * * @author Sebastien Deleuze * @since 5.0 */ -inline fun ListableBeanFactory.getBeanNamesForType(includeNonSingletons: Boolean = true, allowEagerInit: Boolean = true): Array = - getBeanNamesForType(T::class.java, includeNonSingletons, allowEagerInit) +inline fun ListableBeanFactory.getBeanNamesForType(includeNonSingletons: Boolean = true, + allowEagerInit: Boolean = true): Array = + getBeanNamesForType(T::class.java, includeNonSingletons, allowEagerInit) /** * Extension for [ListableBeanFactory.getBeansOfType] providing a `getBeansOfType()` variant. @@ -31,11 +33,13 @@ inline fun ListableBeanFactory.getBeanNamesForType(includeNonS * @author Sebastien Deleuze * @since 5.0 */ -inline fun ListableBeanFactory.getBeansOfType(includeNonSingletons: Boolean = true, allowEagerInit: Boolean = true): Map = - getBeansOfType(T::class.java, includeNonSingletons, allowEagerInit) +inline fun ListableBeanFactory.getBeansOfType(includeNonSingletons: Boolean = true, + allowEagerInit: Boolean = true): Map = + getBeansOfType(T::class.java, includeNonSingletons, allowEagerInit) /** - * Extension for [ListableBeanFactory.getBeanNamesForAnnotation] providing a `getBeansOfType()` variant. + * Extension for [ListableBeanFactory.getBeanNamesForAnnotation] providing a + * `getBeansOfType()` variant. * * @author Sebastien Deleuze * @since 5.0 @@ -44,7 +48,8 @@ inline fun ListableBeanFactory.getBeanNamesForAnnotatio getBeanNamesForAnnotation(T::class.java) /** - * Extension for [ListableBeanFactory.getBeansWithAnnotation] providing a `getBeansWithAnnotation()` variant. + * Extension for [ListableBeanFactory.getBeansWithAnnotation] providing a + * `getBeansWithAnnotation()` variant. * * @author Sebastien Deleuze * @since 5.0 @@ -53,7 +58,8 @@ inline fun ListableBeanFactory.getBeansWithAnnotation() getBeansWithAnnotation(T::class.java) /** - * Extension for [ListableBeanFactory.findAnnotationOnBean] providing a `findAnnotationOnBean("foo")` variant. + * Extension for [ListableBeanFactory.findAnnotationOnBean] providing a + * `findAnnotationOnBean("foo")` variant. * * @author Sebastien Deleuze * @since 5.0 diff --git a/spring-beans/src/test/kotlin/org/springframework/beans/BeanUtilsKotlinTests.kt b/spring-beans/src/test/kotlin/org/springframework/beans/BeanUtilsKotlinTests.kt index c2b64d5d82..01b2c4a3b0 100644 --- a/spring-beans/src/test/kotlin/org/springframework/beans/BeanUtilsKotlinTests.kt +++ b/spring-beans/src/test/kotlin/org/springframework/beans/BeanUtilsKotlinTests.kt @@ -20,7 +20,7 @@ import org.junit.Assert.* import org.junit.Test /** - * Kotlin tests for {@link BeanUtils} + * Kotlin tests for {@link BeanUtils}. * * @author Sebastien Deleuze */ diff --git a/spring-beans/src/test/kotlin/org/springframework/beans/factory/BeanFactoryExtensionsTests.kt b/spring-beans/src/test/kotlin/org/springframework/beans/factory/BeanFactoryExtensionsTests.kt index aebabbc06b..a3b0273de0 100644 --- a/spring-beans/src/test/kotlin/org/springframework/beans/factory/BeanFactoryExtensionsTests.kt +++ b/spring-beans/src/test/kotlin/org/springframework/beans/factory/BeanFactoryExtensionsTests.kt @@ -24,7 +24,7 @@ import org.mockito.Mockito.* import org.mockito.junit.MockitoJUnitRunner /** - * Mock object based tests for BeanFactory Kotlin extensions + * Mock object based tests for BeanFactory Kotlin extensions. * * @author Sebastien Deleuze */ diff --git a/spring-beans/src/test/kotlin/org/springframework/beans/factory/annotation/KotlinAutowiredTests.kt b/spring-beans/src/test/kotlin/org/springframework/beans/factory/annotation/KotlinAutowiredTests.kt index 07c541e25b..6319fa0878 100644 --- a/spring-beans/src/test/kotlin/org/springframework/beans/factory/annotation/KotlinAutowiredTests.kt +++ b/spring-beans/src/test/kotlin/org/springframework/beans/factory/annotation/KotlinAutowiredTests.kt @@ -231,7 +231,8 @@ class KotlinAutowiredTests { val optional: String = "foo", val injectedFromConstructor: TestBean ) { - @Autowired constructor(injectedFromSecondaryConstructor: Colour, injectedFromConstructor: TestBean, optional: String = "bar") : this(optional, injectedFromConstructor) { + @Autowired constructor(injectedFromSecondaryConstructor: Colour, injectedFromConstructor: TestBean, + optional: String = "bar") : this(optional, injectedFromConstructor) { this.injectedFromSecondaryConstructor = injectedFromSecondaryConstructor } @@ -247,7 +248,8 @@ class KotlinAutowiredTests { val optional: String = "foo", val injectedFromConstructor: TestBean ) { - constructor(injectedFromSecondaryConstructor: Colour, injectedFromConstructor: TestBean, optional: String = "bar") : this(optional, injectedFromConstructor) { + constructor(injectedFromSecondaryConstructor: Colour, injectedFromConstructor: TestBean, + optional: String = "bar") : this(optional, injectedFromConstructor) { this.injectedFromSecondaryConstructor = injectedFromSecondaryConstructor } diff --git a/spring-context/src/main/kotlin/org/springframework/context/support/BeanDefinitionDsl.kt b/spring-context/src/main/kotlin/org/springframework/context/support/BeanDefinitionDsl.kt index a6bed36d0d..930d3cd51f 100644 --- a/spring-context/src/main/kotlin/org/springframework/context/support/BeanDefinitionDsl.kt +++ b/spring-context/src/main/kotlin/org/springframework/context/support/BeanDefinitionDsl.kt @@ -71,11 +71,13 @@ fun beans(init: BeanDefinitionDsl.() -> Unit): BeanDefinitionDsl { * Class implementing functional bean definition Kotlin DSL. * * @constructor Create a new bean definition DSL. - * @param condition the predicate to fulfill in order to take in account the inner bean definition block + * @param condition the predicate to fulfill in order to take in account the inner + * bean definition block * @author Sebastien Deleuze * @since 5.0 */ -open class BeanDefinitionDsl(private val condition: (ConfigurableEnvironment) -> Boolean = { true }) : ApplicationContextInitializer { +open class BeanDefinitionDsl(private val condition: (ConfigurableEnvironment) -> Boolean = { true }) + : ApplicationContextInitializer { @PublishedApi internal val registrations = arrayListOf<(GenericApplicationContext) -> Unit>() @@ -131,7 +133,8 @@ open class BeanDefinitionDsl(private val condition: (ConfigurableEnvironment) -> /** * Provide read access to some application context facilities. * @constructor Create a new bean definition context. - * @param context the `ApplicationContext` instance to use for retrieving bean references, `Environment`, etc. + * @param context the `ApplicationContext` instance to use for retrieving bean + * references, `Environment`, etc. */ inner class BeanDefinitionContext(@PublishedApi internal val context: GenericApplicationContext) { @@ -163,7 +166,8 @@ open class BeanDefinitionDsl(private val condition: (ConfigurableEnvironment) -> * @param isLazyInit Set whether this bean should be lazily initialized. * @param isPrimary Set whether this bean is a primary autowire candidate. * @param autowireMode Set the autowire mode, `Autowire.CONSTRUCTOR` by default - * @param isAutowireCandidate Set whether this bean is a candidate for getting autowired into some other bean. + * @param isAutowireCandidate Set whether this bean is a candidate for getting + * autowired into some other bean. * @see GenericApplicationContext.registerBean * @see org.springframework.beans.factory.config.BeanDefinition */ @@ -200,7 +204,8 @@ open class BeanDefinitionDsl(private val condition: (ConfigurableEnvironment) -> * @param isLazyInit Set whether this bean should be lazily initialized. * @param isPrimary Set whether this bean is a primary autowire candidate. * @param autowireMode Set the autowire mode, `Autowire.NO` by default - * @param isAutowireCandidate Set whether this bean is a candidate for getting autowired into some other bean. + * @param isAutowireCandidate Set whether this bean is a candidate for getting + * autowired into some other bean. * @param function the bean supplier function * @see GenericApplicationContext.registerBean * @see org.springframework.beans.factory.config.BeanDefinition @@ -226,8 +231,10 @@ open class BeanDefinitionDsl(private val condition: (ConfigurableEnvironment) -> registrations.add { val beanContext = BeanDefinitionContext(it) when (name) { - null -> it.registerBean(T::class.java, Supplier { function.invoke(beanContext) }, customizer) - else -> it.registerBean(name, T::class.java, Supplier { function.invoke(beanContext) }, customizer) + null -> it.registerBean(T::class.java, + Supplier { function.invoke(beanContext) }, customizer) + else -> it.registerBean(name, T::class.java, + Supplier { function.invoke(beanContext) }, customizer) } } } @@ -246,9 +253,11 @@ open class BeanDefinitionDsl(private val condition: (ConfigurableEnvironment) -> /** * Take in account bean definitions enclosed in the provided lambda only when the * specified environment-based predicate is true. - * @param condition the predicate to fulfill in order to take in account the inner bean definition block + * @param condition the predicate to fulfill in order to take in account the inner + * bean definition block */ - fun environment(condition: ConfigurableEnvironment.() -> Boolean, init: BeanDefinitionDsl.() -> Unit): BeanDefinitionDsl { + fun environment(condition: ConfigurableEnvironment.() -> Boolean, + init: BeanDefinitionDsl.() -> Unit): BeanDefinitionDsl { val beans = BeanDefinitionDsl(condition::invoke) beans.init() children.add(beans) diff --git a/spring-context/src/main/kotlin/org/springframework/context/support/GenericApplicationContextExtensions.kt b/spring-context/src/main/kotlin/org/springframework/context/support/GenericApplicationContextExtensions.kt index 4c260e10ca..cc74d0fc29 100644 --- a/spring-context/src/main/kotlin/org/springframework/context/support/GenericApplicationContextExtensions.kt +++ b/spring-context/src/main/kotlin/org/springframework/context/support/GenericApplicationContextExtensions.kt @@ -20,9 +20,9 @@ import org.springframework.beans.factory.config.BeanDefinitionCustomizer import org.springframework.context.ApplicationContext import java.util.function.Supplier - /** - * Extension for [GenericApplicationContext.registerBean] providing a `registerBean()` variant. + * Extension for [GenericApplicationContext.registerBean] providing a + * `registerBean()` variant. * * @author Sebastien Deleuze * @since 5.0 @@ -32,12 +32,14 @@ inline fun GenericApplicationContext.registerBean(vararg custo } /** - * Extension for [GenericApplicationContext.registerBean] providing a `registerBean("foo")` variant. + * Extension for [GenericApplicationContext.registerBean] providing a + * `registerBean("foo")` variant. * * @author Sebastien Deleuze * @since 5.0 */ -inline fun GenericApplicationContext.registerBean(beanName: String, vararg customizers: BeanDefinitionCustomizer) { +inline fun GenericApplicationContext.registerBean(beanName: String, + vararg customizers: BeanDefinitionCustomizer) { registerBean(beanName, T::class.java, *customizers) } @@ -53,7 +55,8 @@ inline fun GenericApplicationContext.registerBean( } /** - * Extension for [GenericApplicationContext.registerBean] providing a `registerBean("foo") { Foo() }` variant. + * Extension for [GenericApplicationContext.registerBean] providing a + * `registerBean("foo") { Foo() }` variant. * * @author Sebastien Deleuze * @since 5.0 @@ -64,10 +67,12 @@ inline fun GenericApplicationContext.registerBean(name: String } /** - * Extension for [GenericApplicationContext] allowing `GenericApplicationContext { ... }` style initialization. + * Extension for [GenericApplicationContext] allowing `GenericApplicationContext { ... }` + * style initialization. * * @author Sebastien Deleuze * @since 5.0 */ -fun GenericApplicationContext(configure: GenericApplicationContext.() -> Unit) = GenericApplicationContext().apply(configure) +fun GenericApplicationContext(configure: GenericApplicationContext.() -> Unit) = + GenericApplicationContext().apply(configure) diff --git a/spring-context/src/test/kotlin/org/springframework/context/annotation/AnnotationConfigApplicationContextExtensionsTests.kt b/spring-context/src/test/kotlin/org/springframework/context/annotation/AnnotationConfigApplicationContextExtensionsTests.kt index e63d80ff50..0ad5e7e163 100644 --- a/spring-context/src/test/kotlin/org/springframework/context/annotation/AnnotationConfigApplicationContextExtensionsTests.kt +++ b/spring-context/src/test/kotlin/org/springframework/context/annotation/AnnotationConfigApplicationContextExtensionsTests.kt @@ -22,7 +22,7 @@ import org.springframework.beans.factory.getBean import org.springframework.context.support.registerBean /** - * Tests for [AnnotationConfigApplicationContext] Kotlin extensions + * Tests for [AnnotationConfigApplicationContext] Kotlin extensions. * * @author Sebastien Deleuze */ diff --git a/spring-context/src/test/kotlin/org/springframework/ui/ModelExtensionsTests.kt b/spring-context/src/test/kotlin/org/springframework/ui/ModelExtensionsTests.kt index 45a17c8345..c07219551d 100644 --- a/spring-context/src/test/kotlin/org/springframework/ui/ModelExtensionsTests.kt +++ b/spring-context/src/test/kotlin/org/springframework/ui/ModelExtensionsTests.kt @@ -20,9 +20,8 @@ import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue import org.junit.Test - /** - * Tests for [Model] Kotlin extensions + * Tests for [Model] Kotlin extensions. * * @author Sebastien Deleuze */ diff --git a/spring-context/src/test/kotlin/org/springframework/ui/ModelMapExtensionsTests.kt b/spring-context/src/test/kotlin/org/springframework/ui/ModelMapExtensionsTests.kt index 1543721f21..1950eef684 100644 --- a/spring-context/src/test/kotlin/org/springframework/ui/ModelMapExtensionsTests.kt +++ b/spring-context/src/test/kotlin/org/springframework/ui/ModelMapExtensionsTests.kt @@ -20,9 +20,8 @@ import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue import org.junit.Test - /** - * Tests for [ModelMap] Kotlin extensions + * Tests for [ModelMap] Kotlin extensions. * * @author Sebastien Deleuze */ diff --git a/spring-core/src/test/kotlin/org/springframework/core/env/PropertyResolverExtensionsTests.kt b/spring-core/src/test/kotlin/org/springframework/core/env/PropertyResolverExtensionsTests.kt index e505b25765..aedd8a0391 100644 --- a/spring-core/src/test/kotlin/org/springframework/core/env/PropertyResolverExtensionsTests.kt +++ b/spring-core/src/test/kotlin/org/springframework/core/env/PropertyResolverExtensionsTests.kt @@ -24,7 +24,7 @@ import org.mockito.Mockito import org.mockito.junit.MockitoJUnitRunner /** - * Mock object based tests for PropertyResolver Kotlin extensions + * Mock object based tests for PropertyResolver Kotlin extensions. * * @author Sebastien Deleuze */ diff --git a/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensions.kt b/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensions.kt index 639bfac930..5f4abea631 100644 --- a/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensions.kt +++ b/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensions.kt @@ -18,17 +18,18 @@ package org.springframework.jdbc.core import java.sql.ResultSet - /** - * Extension for [JdbcOperations.queryForObject] providing a `queryForObject("...")` variant + * Extension for [JdbcOperations.queryForObject] providing a `queryForObject("...")` variant. * * @author Mario Arias * @since 5.0 */ -inline fun JdbcOperations.queryForObject(sql: String): T? = queryForObject(sql, T::class.java) +inline fun JdbcOperations.queryForObject(sql: String): T? = + queryForObject(sql, T::class.java) /** - * Extensions for [JdbcOperations.queryForObject] providing a RowMapper-like function variant: `queryForObject("...", arg1, argN){ rs, i -> }`. + * Extensions for [JdbcOperations.queryForObject] providing a RowMapper-like function + * variant: `queryForObject("...", arg1, argN){ rs, i -> }`. * * @author Mario Arias * @since 5.0 @@ -37,7 +38,8 @@ fun JdbcOperations.queryForObject(sql: String, vararg args: Any, funct queryForObject(sql, RowMapper { resultSet, i -> function(resultSet, i) }, *args) /** - * Extension for [JdbcOperations.queryForObject] providing a `queryForObject("...", arrayOf(arg1, argN), intArray(type1, typeN))` variant + * Extension for [JdbcOperations.queryForObject] providing a + * `queryForObject("...", arrayOf(arg1, argN), intArray(type1, typeN))` variant. * * @author Mario Arias * @since 5.0 @@ -46,7 +48,8 @@ inline fun JdbcOperations.queryForObject(sql: String, args: Ar queryForObject(sql, args, argTypes, T::class.java) /** - * Extension for [JdbcOperations.queryForObject] providing a `queryForObject("...", arrayOf(arg1, argN))` variant + * Extension for [JdbcOperations.queryForObject] providing a + * `queryForObject("...", arrayOf(arg1, argN))` variant. * * @author Mario Arias * @since 5.0 @@ -54,7 +57,6 @@ inline fun JdbcOperations.queryForObject(sql: String, args: Ar inline fun JdbcOperations.queryForObject(sql: String, args: Array): T? = queryForObject(sql, args, T::class.java) - /** * Extension for [JdbcOperations.queryForList] providing a `queryForList("...")` variant. * @@ -66,17 +68,20 @@ inline fun JdbcOperations.queryForList(sql: String): List = queryForList(sql, T::class.java) /** - * Extension for [JdbcOperations.queryForList] providing a `queryForList("...", arrayOf(arg1, argN), intArray(type1, typeN))` variant + * Extension for [JdbcOperations.queryForList] providing a + * `queryForList("...", arrayOf(arg1, argN), intArray(type1, typeN))` variant. * * @author Mario Arias * @since 5.0 */ @Suppress("EXTENSION_SHADOWED_BY_MEMBER") -inline fun JdbcOperations.queryForList(sql: String, args: Array, argTypes: IntArray): List = +inline fun JdbcOperations.queryForList(sql: String, args: Array, + argTypes: IntArray): List = queryForList(sql, args, argTypes, T::class.java) /** - * Extension for [JdbcOperations.queryForList] providing a `queryForList("...", arrayOf(arg1, argN))` variant + * Extension for [JdbcOperations.queryForList] providing a + * `queryForList("...", arrayOf(arg1, argN))` variant. * * @author Mario Arias * @since 5.0 @@ -84,18 +89,20 @@ inline fun JdbcOperations.queryForList(sql: String, args: Arra inline fun JdbcOperations.queryForList(sql: String, args: Array): List = queryForList(sql, args, T::class.java) - /** - * Extension for [JdbcOperations.query] providing a ResultSetExtractor-like function variant: `query("...", arg1, argN){ rs -> }` + * Extension for [JdbcOperations.query] providing a ResultSetExtractor-like function + * variant: `query("...", arg1, argN){ rs -> }`. * * @author Mario Arias * @since 5.0 */ -inline fun JdbcOperations.query(sql: String, vararg args: Any, crossinline function: (ResultSet) -> T): T? = +inline fun JdbcOperations.query(sql: String, vararg args: Any, + crossinline function: (ResultSet) -> T): T? = query(sql, ResultSetExtractor { function(it) }, *args) /** - * Extension for [JdbcOperations.query] providing a RowCallbackHandler-like function variant: `query("...", arg1, argN){ rs -> }` + * Extension for [JdbcOperations.query] providing a RowCallbackHandler-like function + * variant: `query("...", arg1, argN){ rs -> }`. * * @author Mario Arias * @since 5.0 @@ -104,7 +111,8 @@ fun JdbcOperations.query(sql: String, vararg args: Any, function: (ResultSet) -> query(sql, RowCallbackHandler { function(it) }, *args) /** - * Extensions for [JdbcOperations.query] providing a RowMapper-like function variant: `query("...", arg1, argN){ rs, i -> }`. + * Extensions for [JdbcOperations.query] providing a RowMapper-like function variant: + * `query("...", arg1, argN){ rs, i -> }`. * * @author Mario Arias * @since 5.0 diff --git a/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/namedparam/MapSqlParameterSourceExtensions.kt b/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/namedparam/MapSqlParameterSourceExtensions.kt index 681aba568f..abd07a4743 100644 --- a/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/namedparam/MapSqlParameterSourceExtensions.kt +++ b/spring-jdbc/src/main/kotlin/org/springframework/jdbc/core/namedparam/MapSqlParameterSourceExtensions.kt @@ -17,7 +17,7 @@ package org.springframework.jdbc.core.namedparam /** - * Extension for [MapSqlParameterSource.addValue] providing Array like setter + * Extension for [MapSqlParameterSource.addValue] providing Array like setter. * * ```kotlin * source["age"] = 3 @@ -31,7 +31,7 @@ operator fun MapSqlParameterSource.set(paramName: String, value: Any) { } /** - * Extension for [MapSqlParameterSource.addValue] providing Array like setter + * Extension for [MapSqlParameterSource.addValue] providing Array like setter. * * ```kotlin * source["age", JDBCType.INTEGER.vendorTypeNumber] = 3 diff --git a/spring-jdbc/src/test/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensionsTests.kt b/spring-jdbc/src/test/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensionsTests.kt index c7c9e05e6b..705b8e0548 100644 --- a/spring-jdbc/src/test/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensionsTests.kt +++ b/spring-jdbc/src/test/kotlin/org/springframework/jdbc/core/JdbcOperationsExtensionsTests.kt @@ -16,7 +16,6 @@ package org.springframework.jdbc.core - import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith diff --git a/spring-jdbc/src/test/kotlin/org/springframework/jdbc/core/namedparam/MapSqlParameterSourceExtensionsTests.kt b/spring-jdbc/src/test/kotlin/org/springframework/jdbc/core/namedparam/MapSqlParameterSourceExtensionsTests.kt index dd388e98a7..147e9efad7 100644 --- a/spring-jdbc/src/test/kotlin/org/springframework/jdbc/core/namedparam/MapSqlParameterSourceExtensionsTests.kt +++ b/spring-jdbc/src/test/kotlin/org/springframework/jdbc/core/namedparam/MapSqlParameterSourceExtensionsTests.kt @@ -21,7 +21,7 @@ import org.junit.Test import java.sql.JDBCType /** - * Tests for [MapSqlParameterSource] Kotlin extensions + * Tests for [MapSqlParameterSource] Kotlin extensions. * * @author Mario Arias */ diff --git a/spring-test/src/main/kotlin/org/springframework/test/web/reactive/server/WebTestClientExtensions.kt b/spring-test/src/main/kotlin/org/springframework/test/web/reactive/server/WebTestClientExtensions.kt index 062a195bf8..e55735c648 100644 --- a/spring-test/src/main/kotlin/org/springframework/test/web/reactive/server/WebTestClientExtensions.kt +++ b/spring-test/src/main/kotlin/org/springframework/test/web/reactive/server/WebTestClientExtensions.kt @@ -17,42 +17,43 @@ package org.springframework.test.web.reactive.server import org.reactivestreams.Publisher +import org.springframework.test.web.reactive.server.WebTestClient.* /** - * Extension for [WebTestClient.RequestBodySpec.body] providing a variant without explicit class + * Extension for [RequestBodySpec.body] providing a variant without explicit class * parameter thanks to Kotlin reified type parameters. * * @author Sebastien Deleuze * @since 5.0 */ -inline fun > WebTestClient.RequestBodySpec.body(publisher: S): WebTestClient.RequestHeadersSpec<*> +inline fun > RequestBodySpec.body(publisher: S): RequestHeadersSpec<*> = body(publisher, T::class.java) /** - * Extension for [WebTestClient.ResponseSpec.expectBody] providing a `expectBody()` variant. + * Extension for [ResponseSpec.expectBody] providing a `expectBody()` variant. * * @author Sebastien Deleuze * @since 5.0 */ @Suppress("EXTENSION_SHADOWED_BY_MEMBER") -inline fun WebTestClient.ResponseSpec.expectBody(): WebTestClient.BodySpec = +inline fun ResponseSpec.expectBody(): BodySpec = expectBody(B::class.java) /** - * Extension for [WebTestClient.ResponseSpec.expectBodyList] providing a `expectBodyList()` variant. + * Extension for [ResponseSpec.expectBodyList] providing a `expectBodyList()` variant. * * @author Sebastien Deleuze * @since 5.0 */ -inline fun WebTestClient.ResponseSpec.expectBodyList(): WebTestClient.ListBodySpec = +inline fun ResponseSpec.expectBodyList(): ListBodySpec = expectBodyList(E::class.java) /** - * Extension for [WebTestClient.ResponseSpec.returnResult] providing a `returnResult()` variant. + * Extension for [ResponseSpec.returnResult] providing a `returnResult()` variant. * * @author Sebastien Deleuze * @since 5.0 */ @Suppress("EXTENSION_SHADOWED_BY_MEMBER") -inline fun WebTestClient.ResponseSpec.returnResult(): FluxExchangeResult = +inline fun ResponseSpec.returnResult(): FluxExchangeResult = returnResult(T::class.java) diff --git a/spring-test/src/test/kotlin/org/springframework/test/web/reactive/server/WebTestClientExtensionsTests.kt b/spring-test/src/test/kotlin/org/springframework/test/web/reactive/server/WebTestClientExtensionsTests.kt index 096284bd1c..13dc600984 100644 --- a/spring-test/src/test/kotlin/org/springframework/test/web/reactive/server/WebTestClientExtensionsTests.kt +++ b/spring-test/src/test/kotlin/org/springframework/test/web/reactive/server/WebTestClientExtensionsTests.kt @@ -26,7 +26,6 @@ import org.mockito.Mock import org.mockito.junit.MockitoJUnitRunner import org.reactivestreams.Publisher - /** * Mock object based tests for [WebTestClient] Kotlin extensions * diff --git a/spring-web/src/main/kotlin/org/springframework/web/client/RestOperationsExtensions.kt b/spring-web/src/main/kotlin/org/springframework/web/client/RestOperationsExtensions.kt index c063519c51..621407626b 100644 --- a/spring-web/src/main/kotlin/org/springframework/web/client/RestOperationsExtensions.kt +++ b/spring-web/src/main/kotlin/org/springframework/web/client/RestOperationsExtensions.kt @@ -23,7 +23,6 @@ import org.springframework.http.RequestEntity import org.springframework.http.ResponseEntity import java.net.URI - /** * Extension for [RestOperations.getForObject] avoiding specifying the type * parameter thanks to Kotlin reified type parameters. @@ -117,7 +116,8 @@ inline fun RestOperations.postForObject(url: URI, request: Any) * @since 5.0 */ @Throws(RestClientException::class) -inline fun RestOperations.postForEntity(url: String, request: Any, vararg uriVariables: Any): ResponseEntity = +inline fun RestOperations.postForEntity(url: String, request: Any, + vararg uriVariables: Any): ResponseEntity = postForEntity(url, request, T::class.java, *uriVariables) /** @@ -129,7 +129,8 @@ inline fun RestOperations.postForEntity(url: String, request: A * @since 5.0 */ @Throws(RestClientException::class) -inline fun RestOperations.postForEntity(url: String, request: Any, uriVariables: Map): ResponseEntity = +inline fun RestOperations.postForEntity(url: String, request: Any, + uriVariables: Map): ResponseEntity = postForEntity(url, request, T::class.java, uriVariables) /** @@ -153,7 +154,8 @@ inline fun RestOperations.postForEntity(url: URI, request: Any) * @since 5.0 */ @Throws(RestClientException::class) -inline fun RestOperations.exchange(url: String, method: HttpMethod, requestEntity: HttpEntity<*>, vararg uriVariables: Any): ResponseEntity = +inline fun RestOperations.exchange(url: String, method: HttpMethod, + requestEntity: HttpEntity<*>, vararg uriVariables: Any): ResponseEntity = exchange(url, method, requestEntity, object : ParameterizedTypeReference() {}, *uriVariables) /** @@ -165,7 +167,8 @@ inline fun RestOperations.exchange(url: String, method: HttpMet * @since 5.0 */ @Throws(RestClientException::class) -inline fun RestOperations.exchange(url: String, method: HttpMethod, requestEntity: HttpEntity<*>, uriVariables: Map): ResponseEntity = +inline fun RestOperations.exchange(url: String, method: HttpMethod, + requestEntity: HttpEntity<*>, uriVariables: Map): ResponseEntity = exchange(url, method, requestEntity, object : ParameterizedTypeReference() {}, uriVariables) /** @@ -177,7 +180,8 @@ inline fun RestOperations.exchange(url: String, method: HttpMet * @since 5.0 */ @Throws(RestClientException::class) -inline fun RestOperations.exchange(url: URI, method: HttpMethod, requestEntity: HttpEntity<*>): ResponseEntity = +inline fun RestOperations.exchange(url: URI, method: HttpMethod, + requestEntity: HttpEntity<*>): ResponseEntity = exchange(url, method, requestEntity, object : ParameterizedTypeReference() {}) /** diff --git a/spring-web/src/test/kotlin/org/springframework/web/client/RestOperationsExtensionsTests.kt b/spring-web/src/test/kotlin/org/springframework/web/client/RestOperationsExtensionsTests.kt index 3c4476bf9b..18878b9b32 100644 --- a/spring-web/src/test/kotlin/org/springframework/web/client/RestOperationsExtensionsTests.kt +++ b/spring-web/src/test/kotlin/org/springframework/web/client/RestOperationsExtensionsTests.kt @@ -30,7 +30,7 @@ import org.springframework.http.RequestEntity import java.net.URI /** - * Mock object based tests for [RestOperations] Kotlin extensions + * Mock object based tests for [RestOperations] Kotlin extensions. * * @author Sebastien Deleuze */ @@ -135,7 +135,8 @@ class RestOperationsExtensionsTests { val var1 = "var1" val var2 = "var2" template.exchange>(url, method, entity, var1, var2) - verify(template, times(1)).exchange(url, method, entity, object : ParameterizedTypeReference>() {}, var1, var2) + verify(template, times(1)).exchange(url, method, entity, + object : ParameterizedTypeReference>() {}, var1, var2) } @Test @@ -145,7 +146,8 @@ class RestOperationsExtensionsTests { val entity = mock>() val vars = mapOf(Pair("key1", "value1"), Pair("key2", "value2")) template.exchange>(url, method, entity, vars) - verify(template, times(1)).exchange(url, method, entity, object : ParameterizedTypeReference>() {}, vars) + verify(template, times(1)).exchange(url, method, entity, + object : ParameterizedTypeReference>() {}, vars) } @Test @@ -154,14 +156,16 @@ class RestOperationsExtensionsTests { val method = HttpMethod.GET val entity = mock>() template.exchange>(url, method, entity) - verify(template, times(1)).exchange(url, method, entity, object : ParameterizedTypeReference>() {}) + verify(template, times(1)).exchange(url, method, entity, + object : ParameterizedTypeReference>() {}) } @Test fun `exchange with reified type parameters, String, HttpEntity`() { val entity = mock>() template.exchange>(entity) - verify(template, times(1)).exchange(entity, object : ParameterizedTypeReference>() {}) + verify(template, times(1)).exchange(entity, + object : ParameterizedTypeReference>() {}) } class Foo diff --git a/spring-web/src/test/kotlin/org/springframework/web/method/annotation/RequestParamMethodArgumentResolverKotlinTests.kt b/spring-web/src/test/kotlin/org/springframework/web/method/annotation/RequestParamMethodArgumentResolverKotlinTests.kt index 1f587cb145..bbefd748cb 100644 --- a/spring-web/src/test/kotlin/org/springframework/web/method/annotation/RequestParamMethodArgumentResolverKotlinTests.kt +++ b/spring-web/src/test/kotlin/org/springframework/web/method/annotation/RequestParamMethodArgumentResolverKotlinTests.kt @@ -16,7 +16,6 @@ package org.springframework.web.method.annotation - import org.junit.Assert.assertEquals import org.junit.Assert.assertNull import org.junit.Before diff --git a/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/client/ClientResponseExtensions.kt b/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/client/ClientResponseExtensions.kt index 29bdf36cf1..2260fac1f6 100644 --- a/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/client/ClientResponseExtensions.kt +++ b/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/client/ClientResponseExtensions.kt @@ -21,7 +21,6 @@ import org.springframework.http.ResponseEntity import reactor.core.publisher.Flux import reactor.core.publisher.Mono - /** * Extension for [ClientResponse.bodyToMono] providing a `bodyToMono()` variant * leveraging Kotlin reified type parameters. diff --git a/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/client/WebClientExtensions.kt b/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/client/WebClientExtensions.kt index 93a24c136c..c2e79b9a31 100644 --- a/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/client/WebClientExtensions.kt +++ b/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/client/WebClientExtensions.kt @@ -18,10 +18,11 @@ package org.springframework.web.reactive.function.client import org.reactivestreams.Publisher import org.springframework.core.ParameterizedTypeReference +import org.springframework.web.reactive.function.client.WebClient.RequestBodySpec +import org.springframework.web.reactive.function.client.WebClient.RequestHeadersSpec import reactor.core.publisher.Flux import reactor.core.publisher.Mono - /** * Extension for [WebClient.RequestBodySpec.body] providing a `body()` variant * leveraging Kotlin reified type parameters. @@ -30,7 +31,7 @@ import reactor.core.publisher.Mono * @since 5.0 */ @Suppress("EXTENSION_SHADOWED_BY_MEMBER") -inline fun > WebClient.RequestBodySpec.body(publisher: S): WebClient.RequestHeadersSpec<*> = +inline fun > RequestBodySpec.body(publisher: S): RequestHeadersSpec<*> = body(publisher, object : ParameterizedTypeReference() {}) /** diff --git a/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDsl.kt b/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDsl.kt index 5cfafce5a4..de95ef625f 100644 --- a/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDsl.kt +++ b/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDsl.kt @@ -21,10 +21,10 @@ import org.springframework.http.HttpMethod import org.springframework.http.MediaType import reactor.core.publisher.Mono - /** * Allow to create easily a `RouterFunction` from a Kotlin router DSL based - * on the same building blocks than the Java one ([RouterFunction], [RequestPredicate], [HandlerFunction]). + * on the same building blocks than the Java one ([RouterFunction], [RequestPredicate], + * [HandlerFunction]). * * Example: * @@ -126,9 +126,9 @@ open class RouterFunctionDsl { operator fun RequestPredicate.not(): RequestPredicate = this.negate() /** - * Route to the given router function if the given request predicate applies. This method can be - * used to create *nested routes*, where a group of routes share a common path (prefix), - * header, or other request predicate. + * Route to the given router function if the given request predicate applies. This + * method can be used to create *nested routes*, where a group of routes share a + * common path (prefix), header, or other request predicate. * @see RouterFunctions.nest */ fun RequestPredicate.nest(r: RouterFunctionDsl.() -> Unit) { @@ -305,7 +305,8 @@ open class RouterFunctionDsl { * @param headersPredicate a predicate that tests against the request headers * @return a predicate that tests against the given header predicate */ - fun headers(headersPredicate: (ServerRequest.Headers) -> Boolean): RequestPredicate = RequestPredicates.headers(headersPredicate) + fun headers(headersPredicate: (ServerRequest.Headers) -> Boolean): RequestPredicate = + RequestPredicates.headers(headersPredicate) /** * Route to the given handler function if the given method predicate applies. @@ -364,7 +365,8 @@ open class RouterFunctionDsl { * predicate. * @see RequestPredicates.pathExtension */ - fun pathExtension(predicate: (String) -> Boolean): RequestPredicate = RequestPredicates.pathExtension(predicate) + fun pathExtension(predicate: (String) -> Boolean): RequestPredicate = + RequestPredicates.pathExtension(predicate) /** * Route to the given handler function if the given queryParam predicate applies. @@ -382,7 +384,8 @@ open class RouterFunctionDsl { * @return a predicate that matches the given predicate against the query parameter of the given name * @see ServerRequest#queryParam(String) */ - fun queryParam(name: String, predicate: (String) -> Boolean): RequestPredicate = RequestPredicates.queryParam(name, predicate) + fun queryParam(name: String, predicate: (String) -> Boolean): RequestPredicate = + RequestPredicates.queryParam(name, predicate) /** * Route to the given handler function if the given request predicate applies. diff --git a/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/ServerRequestExtensions.kt b/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/ServerRequestExtensions.kt index 394a04dc4f..6ee48e924e 100644 --- a/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/ServerRequestExtensions.kt +++ b/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/ServerRequestExtensions.kt @@ -20,7 +20,6 @@ import org.springframework.core.ParameterizedTypeReference import reactor.core.publisher.Flux import reactor.core.publisher.Mono - /** * Extension for [ServerRequest.bodyToMono] providing a `bodyToMono()` variant * leveraging Kotlin reified type parameters. diff --git a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/client/ClientResponseExtensionsTests.kt b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/client/ClientResponseExtensionsTests.kt index 06da9219b8..6110f4630e 100644 --- a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/client/ClientResponseExtensionsTests.kt +++ b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/client/ClientResponseExtensionsTests.kt @@ -26,7 +26,7 @@ import org.mockito.junit.MockitoJUnitRunner import org.springframework.core.ParameterizedTypeReference /** - * Mock object based tests for [ClientResponse] Kotlin extensions + * Mock object based tests for [ClientResponse] Kotlin extensions. * * @author Sebastien Deleuze */ diff --git a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDslTests.kt b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDslTests.kt index eebca2d3c9..d9a9842659 100644 --- a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDslTests.kt +++ b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/RouterFunctionDslTests.kt @@ -28,7 +28,7 @@ import reactor.test.StepVerifier import java.net.URI /** - * Tests for [RouterFunction] Kotlin DSL + * Tests for [RouterFunction] Kotlin DSL. * * @author Sebastien Deleuze */ @@ -52,7 +52,11 @@ class RouterFunctionDslTests { @Test fun acceptAndPOST() { - val request = builder().method(POST).uri(URI("/api/foo/")).header(ACCEPT, APPLICATION_JSON_VALUE).build() + val request = builder() + .method(POST) + .uri(URI("/api/foo/")) + .header(ACCEPT, APPLICATION_JSON_VALUE) + .build() StepVerifier.create(sampleRouter().route(request)) .expectNextCount(1) .verifyComplete() diff --git a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/ServerRequestExtensionsTests.kt b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/ServerRequestExtensionsTests.kt index abef2b3017..4beab065fb 100644 --- a/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/ServerRequestExtensionsTests.kt +++ b/spring-webflux/src/test/kotlin/org/springframework/web/reactive/function/server/ServerRequestExtensionsTests.kt @@ -28,7 +28,7 @@ import org.springframework.web.reactive.function.server.bodyToFlux import org.springframework.web.reactive.function.server.bodyToMono /** - * Mock object based tests for [ServerRequest] Kotlin extensions + * Mock object based tests for [ServerRequest] Kotlin extensions. * * @author Sebastien Deleuze */