|
|
|
|
|
by ptx
3306 days ago
|
|
The "Fully Fluent API" seems to be a style adopted as a workaround for the clumsiness of the Java language, as far as I can tell. In Kotlin it's not necessary and just looks a bit weird. This example in Java: Javalin app = Javalin.create()
.port(7000)
app.start()
.awaitInitialization()
.stop()
.awaitTermination();
could be written more naturally in Kotlin: val app = Javalin.create().apply {
port = 7000
}
with(app) {
start()
awaitInitialization()
stop()
awaitTermination()
}
...except that Javalin doesn't seem to implement the normal convention for getters and setters, so the apply block wouldn't work. |
|