@@ -244,13 +244,14 @@ private constructor(
244244 fun value (value : JsonField <Value >) = apply { this .value = value }
245245
246246 /* * A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
247- fun value (string : String ) = value(Value .ofString(string ))
247+ fun value (regex : String ) = value(Value .ofRegex(regex ))
248248
249249 /* * A number, to be used with `IS_GREATER_THAN` or `IS_LESS_THAN` */
250- fun value (integer : Long ) = value(Value .ofInteger(integer ))
250+ fun value (number : Long ) = value(Value .ofNumber(number ))
251251
252252 /* * An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */
253- fun valueOfStrings (strings : List <String >) = value(Value .ofStrings(strings))
253+ fun valueOfListOfStrings (listOfStrings : List <String >) =
254+ value(Value .ofListOfStrings(listOfStrings))
254255
255256 fun additionalProperties (additionalProperties : Map <String , JsonValue >) = apply {
256257 this .additionalProperties.clear()
@@ -404,43 +405,43 @@ private constructor(
404405 @JsonSerialize(using = Value .Serializer ::class )
405406 class Value
406407 private constructor (
407- private val string : String? = null ,
408- private val integer : Long? = null ,
409- private val strings : List <String >? = null ,
408+ private val regex : String? = null ,
409+ private val number : Long? = null ,
410+ private val listOfStrings : List <String >? = null ,
410411 private val _json : JsonValue ? = null ,
411412 ) {
412413
413414 /* * A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
414- fun string (): Optional <String > = Optional .ofNullable(string )
415+ fun regex (): Optional <String > = Optional .ofNullable(regex )
415416
416417 /* * A number, to be used with `IS_GREATER_THAN` or `IS_LESS_THAN` */
417- fun integer (): Optional <Long > = Optional .ofNullable(integer )
418+ fun number (): Optional <Long > = Optional .ofNullable(number )
418419
419420 /* * An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */
420- fun strings (): Optional <List <String >> = Optional .ofNullable(strings )
421+ fun listOfStrings (): Optional <List <String >> = Optional .ofNullable(listOfStrings )
421422
422- fun isString (): Boolean = string != null
423+ fun isRegex (): Boolean = regex != null
423424
424- fun isInteger (): Boolean = integer != null
425+ fun isNumber (): Boolean = number != null
425426
426- fun isStrings (): Boolean = strings != null
427+ fun isListOfStrings (): Boolean = listOfStrings != null
427428
428429 /* * A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
429- fun asString (): String = string .getOrThrow(" string " )
430+ fun asRegex (): String = regex .getOrThrow(" regex " )
430431
431432 /* * A number, to be used with `IS_GREATER_THAN` or `IS_LESS_THAN` */
432- fun asInteger (): Long = integer .getOrThrow(" integer " )
433+ fun asNumber (): Long = number .getOrThrow(" number " )
433434
434435 /* * An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */
435- fun asStrings (): List <String > = strings .getOrThrow(" strings " )
436+ fun asListOfStrings (): List <String > = listOfStrings .getOrThrow(" listOfStrings " )
436437
437438 fun _json (): Optional <JsonValue > = Optional .ofNullable(_json )
438439
439440 fun <T > accept (visitor : Visitor <T >): T {
440441 return when {
441- string != null -> visitor.visitString(string )
442- integer != null -> visitor.visitInteger(integer )
443- strings != null -> visitor.visitStrings(strings )
442+ regex != null -> visitor.visitRegex(regex )
443+ number != null -> visitor.visitNumber(number )
444+ listOfStrings != null -> visitor.visitListOfStrings(listOfStrings )
444445 else -> visitor.unknown(_json )
445446 }
446447 }
@@ -454,11 +455,11 @@ private constructor(
454455
455456 accept(
456457 object : Visitor <Unit > {
457- override fun visitString ( string : String ) {}
458+ override fun visitRegex ( regex : String ) {}
458459
459- override fun visitInteger ( integer : Long ) {}
460+ override fun visitNumber ( number : Long ) {}
460461
461- override fun visitStrings ( strings : List <String >) {}
462+ override fun visitListOfStrings ( listOfStrings : List <String >) {}
462463 }
463464 )
464465 validated = true
@@ -469,43 +470,44 @@ private constructor(
469470 return true
470471 }
471472
472- return /* spotless:off */ other is Value && string == other.string && integer == other.integer && strings == other.strings /* spotless:on */
473+ return /* spotless:off */ other is Value && regex == other.regex && number == other.number && listOfStrings == other.listOfStrings /* spotless:on */
473474 }
474475
475- override fun hashCode (): Int = /* spotless:off */ Objects .hash(string, integer, strings ) /* spotless:on */
476+ override fun hashCode (): Int = /* spotless:off */ Objects .hash(regex, number, listOfStrings ) /* spotless:on */
476477
477478 override fun toString (): String =
478479 when {
479- string != null -> " Value{string= $string }"
480- integer != null -> " Value{integer= $integer }"
481- strings != null -> " Value{strings= $strings }"
480+ regex != null -> " Value{regex= $regex }"
481+ number != null -> " Value{number= $number }"
482+ listOfStrings != null -> " Value{listOfStrings= $listOfStrings }"
482483 _json != null -> " Value{_unknown=$_json }"
483484 else -> throw IllegalStateException (" Invalid Value" )
484485 }
485486
486487 companion object {
487488
488489 /* * A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
489- @JvmStatic fun ofString ( string : String ) = Value (string = string )
490+ @JvmStatic fun ofRegex ( regex : String ) = Value (regex = regex )
490491
491492 /* * A number, to be used with `IS_GREATER_THAN` or `IS_LESS_THAN` */
492- @JvmStatic fun ofInteger ( integer : Long ) = Value (integer = integer )
493+ @JvmStatic fun ofNumber ( number : Long ) = Value (number = number )
493494
494495 /* * An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */
495- @JvmStatic fun ofStrings (strings : List <String >) = Value (strings = strings)
496+ @JvmStatic
497+ fun ofListOfStrings (listOfStrings : List <String >) = Value (listOfStrings = listOfStrings)
496498 }
497499
498500 /* * An interface that defines how to map each variant of [Value] to a value of type [T]. */
499501 interface Visitor <out T > {
500502
501503 /* * A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
502- fun visitString ( string : String ): T
504+ fun visitRegex ( regex : String ): T
503505
504506 /* * A number, to be used with `IS_GREATER_THAN` or `IS_LESS_THAN` */
505- fun visitInteger ( integer : Long ): T
507+ fun visitNumber ( number : Long ): T
506508
507509 /* * An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */
508- fun visitStrings ( strings : List <String >): T
510+ fun visitListOfStrings ( listOfStrings : List <String >): T
509511
510512 /* *
511513 * Maps an unknown variant of [Value] to a value of type [T].
@@ -528,13 +530,13 @@ private constructor(
528530 val json = JsonValue .fromJsonNode(node)
529531
530532 tryDeserialize(node, jacksonTypeRef<String >())?.let {
531- return Value (string = it, _json = json)
533+ return Value (regex = it, _json = json)
532534 }
533535 tryDeserialize(node, jacksonTypeRef<Long >())?.let {
534- return Value (integer = it, _json = json)
536+ return Value (number = it, _json = json)
535537 }
536538 tryDeserialize(node, jacksonTypeRef<List <String >>())?.let {
537- return Value (strings = it, _json = json)
539+ return Value (listOfStrings = it, _json = json)
538540 }
539541
540542 return Value (_json = json)
@@ -549,9 +551,9 @@ private constructor(
549551 provider : SerializerProvider
550552 ) {
551553 when {
552- value.string != null -> generator.writeObject(value.string )
553- value.integer != null -> generator.writeObject(value.integer )
554- value.strings != null -> generator.writeObject(value.strings )
554+ value.regex != null -> generator.writeObject(value.regex )
555+ value.number != null -> generator.writeObject(value.number )
556+ value.listOfStrings != null -> generator.writeObject(value.listOfStrings )
555557 value._json != null -> generator.writeObject(value._json )
556558 else -> throw IllegalStateException (" Invalid Value" )
557559 }
0 commit comments