Skip to content

Commit

Permalink
refactor: magic numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
samukce committed Jan 4, 2023
1 parent ba38e5d commit 030e46c
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import kotlin.reflect.jvm.jvmErasure
class DslJsonBodyBuilder {
companion object {
private val ISO_PATTERN = ISO_8601_EXTENDED_DATETIME_TIME_ZONE_FORMAT.pattern
private const val NUMBER_EXAMPLE = 1
private const val DATETIME_EXPRESSION_EXAMPLE = "now"
private const val BOOLEAN_EXAMPLE = true
}

/**
Expand Down Expand Up @@ -78,10 +81,10 @@ class DslJsonBodyBuilder {
Long::class,
Float::class,
Number::class,
Double::class -> rootArray.numberType(1)
Double::class -> rootArray.numberType(NUMBER_EXAMPLE)
String::class -> rootArray.stringType(listTypeCLass.simpleName)
Boolean::class -> rootArray.booleanType(true)
ZonedDateTime::class -> rootArray.datetimeExpression("now", ISO_PATTERN)
Boolean::class -> rootArray.booleanType(BOOLEAN_EXAMPLE)
ZonedDateTime::class -> rootArray.datetimeExpression(DATETIME_EXPRESSION_EXAMPLE, ISO_PATTERN)
else -> {
rootArray.`object` { objDsl ->
objDsl.run {
Expand Down

0 comments on commit 030e46c

Please sign in to comment.