Disambiguate BodyExtractors/Inserters Kotlin function names

This commit is contained in:
Sebastien Deleuze 2017-06-09 01:51:28 +03:00
parent 86580b2358
commit b6c09fa76a
4 changed files with 18 additions and 18 deletions

View File

@ -12,7 +12,7 @@ import kotlin.reflect.KClass
* @since 5.0
* @see [KT-11968](https://youtrack.jetbrains.com/issue/KT-11968)
*/
inline fun <reified T : Any> toMono(): BodyExtractor<Mono<T>, ReactiveHttpInputMessage> =
inline fun <reified T : Any> bodyToMono(): BodyExtractor<Mono<T>, ReactiveHttpInputMessage> =
BodyExtractors.toMono(T::class.java)
/**
@ -22,7 +22,7 @@ inline fun <reified T : Any> toMono(): BodyExtractor<Mono<T>, ReactiveHttpInputM
* @since 5.0
* @see [KT-11968](https://youtrack.jetbrains.com/issue/KT-11968)
*/
fun <T : Any> toMono(elementClass: KClass<T>): BodyExtractor<Mono<T>, ReactiveHttpInputMessage> =
fun <T : Any> bodyToMono(elementClass: KClass<T>): BodyExtractor<Mono<T>, ReactiveHttpInputMessage> =
BodyExtractors.toMono(elementClass.java)
/**
@ -32,7 +32,7 @@ fun <T : Any> toMono(elementClass: KClass<T>): BodyExtractor<Mono<T>, ReactiveHt
* @since 5.0
* @see [KT-11968](https://youtrack.jetbrains.com/issue/KT-11968)
*/
inline fun <reified T : Any> toFlux(): BodyExtractor<Flux<T>, ReactiveHttpInputMessage> =
inline fun <reified T : Any> bodyToFlux(): BodyExtractor<Flux<T>, ReactiveHttpInputMessage> =
BodyExtractors.toFlux(T::class.java)
/**
@ -42,5 +42,5 @@ inline fun <reified T : Any> toFlux(): BodyExtractor<Flux<T>, ReactiveHttpInputM
* @since 5.0
* @see [KT-11968](https://youtrack.jetbrains.com/issue/KT-11968)
*/
fun <T : Any> toFlux(elementClass: KClass<T>): BodyExtractor<Flux<T>, ReactiveHttpInputMessage> =
fun <T : Any> bodyToFlux(elementClass: KClass<T>): BodyExtractor<Flux<T>, ReactiveHttpInputMessage> =
BodyExtractors.toFlux(elementClass.java)

View File

@ -10,7 +10,7 @@ import org.springframework.http.server.reactive.ServerHttpResponse
* @author Sebastien Deleuze
* @since 5.0
*/
inline fun <reified T : Publisher<S>, reified S : Any> fromPublisher(publisher: T): BodyInserter<T, ReactiveHttpOutputMessage> =
inline fun <reified T : Publisher<S>, reified S : Any> bodyFromPublisher(publisher: T): BodyInserter<T, ReactiveHttpOutputMessage> =
BodyInserters.fromPublisher(publisher, S::class.java)
/**
@ -19,5 +19,5 @@ inline fun <reified T : Publisher<S>, reified S : Any> fromPublisher(publisher:
* @author Sebastien Deleuze
* @since 5.0
*/
inline fun <reified T : Publisher<S>, reified S : Any> fromServerSentEvents(publisher: T): BodyInserter<T, ServerHttpResponse> =
inline fun <reified T : Publisher<S>, reified S : Any> bodyFromServerSentEvents(publisher: T): BodyInserter<T, ServerHttpResponse> =
BodyInserters.fromServerSentEvents(publisher, S::class.java)

View File

@ -15,23 +15,23 @@ import org.mockito.junit.MockitoJUnitRunner
class BodyExtractorsExtensionsTests {
@Test
fun `toMono with KClass`() {
assertNotNull(toMono(Foo::class))
fun `bodyToMono with KClass`() {
assertNotNull(bodyToMono(Foo::class))
}
@Test
fun `toMono with reified type parameter`() {
assertNotNull(toMono<Foo>())
fun `bodyToMono with reified type parameter`() {
assertNotNull(bodyToMono<Foo>())
}
@Test
fun `toFlux with KClass`() {
assertNotNull(toFlux(Foo::class))
fun `bodyToFlux with KClass`() {
assertNotNull(bodyToFlux(Foo::class))
}
@Test
fun `toFlux with reified type parameter`() {
assertNotNull(toFlux<Foo>())
fun `bodyToFlux with reified type parameter`() {
assertNotNull(bodyToFlux<Foo>())
}
class Foo

View File

@ -17,15 +17,15 @@ import org.reactivestreams.Publisher
class BodyInsertersExtensionsTests {
@Test
fun `fromPublisher with reified type parameters`() {
fun `bodyFromPublisher with reified type parameters`() {
val publisher = mock<Publisher<Foo>>()
assertNotNull(fromPublisher(publisher))
assertNotNull(bodyFromPublisher(publisher))
}
@Test
fun `fromServerSentEvents with reified type parameters`() {
fun `bodyFromServerSentEvents with reified type parameters`() {
val publisher = mock<Publisher<Foo>>()
assertNotNull(fromServerSentEvents(publisher))
assertNotNull(bodyFromServerSentEvents(publisher))
}
class Foo