Skip to content

Commit

Permalink
speed-up startup slightly by avoiding memberProperties
Browse files Browse the repository at this point in the history
  • Loading branch information
angryziber committed May 24, 2024
1 parent 0576cfe commit 88713b7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/src/klite/StatusCode.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package klite

import kotlin.reflect.full.memberProperties

@JvmInline value class StatusCode(val value: Int) {
companion object {
val OK = StatusCode(200)
Expand Down Expand Up @@ -37,8 +35,10 @@ import kotlin.reflect.full.memberProperties
val GatewayTimeout = StatusCode(504)
val InsufficientStorage = StatusCode(507)

val reasons = Companion::class.memberProperties.associate {
it.get(StatusCode) to it.name.replace("[A-Z]".toRegex(), " $0").trim()
val reasons by lazy {
publicProperties.associate {
it.get(StatusCode) to it.name.replace("[A-Z]".toRegex(), " $0").trim()
}
}
}

Expand Down

0 comments on commit 88713b7

Please sign in to comment.