Improve Kotlin documentation

This commit is contained in:
Sebastien Deleuze
2019-04-09 11:55:02 +02:00
parent 80ad60e91b
commit cd0b517abf
5 changed files with 75 additions and 43 deletions

View File

@@ -25,18 +25,16 @@ import java.util.*
import java.util.function.Supplier
/**
* Allow to create easily a WebMvc.fn `RouterFunction<ServerResponse>` from a Kotlin router
* DSL leveraging WebMvc.fn the Java API ([RouterFunction], [RequestPredicate],
* [HandlerFunction]).
* Allow to create easily a WebMvc.fn [RouterFunction] with a [Reactive router Kotlin DSL][RouterFunctionDsl].
*
* Example:
*
* ```
* @Configuration
* class ApplicationRoutes(val userHandler: UserHandler) {
* class RouterConfiguration {
*
* @Bean
* fun mainRouter() = router {
* fun mainRouter(userHandler: UserHandler) = router {
* accept(TEXT_HTML).nest {
* (GET("/user/") or GET("/users/")).invoke(userHandler::findAllView)
* GET("/users/{login}", userHandler::findViewById)
@@ -50,14 +48,12 @@ import java.util.function.Supplier
* }
* ```
* @author Sebastien Deleuze
* @see RouterFunctionDsl
* @see RouterFunctions.Builder
* @since 5.2
*/
fun router(routes: (RouterFunctionDsl.() -> Unit)) = RouterFunctionDsl(routes).build()
/**
* Provide a WebMvc.fn [RouterFunction] Kotlin DSL in order to be able to write idiomatic Kotlin code.
* Provide a WebMvc.fn [RouterFunction] Reactive Kotlin DSL created by [`router { }`][router] in order to be able to write idiomatic Kotlin code.
*
* @author Sebastien Deleuze
* @since 5.2