All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.pinpointsmsvoicev2.model.TextValidation.kt Maven / Gradle / Ivy

There is a newer version: 1.3.78
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.pinpointsmsvoicev2.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * Validation rules for a text field.
 */
public class TextValidation private constructor(builder: Builder) {
    /**
     * The maximum number of characters for the text field.
     */
    public val maxLength: kotlin.Int = requireNotNull(builder.maxLength) { "A non-null value must be provided for maxLength" }
    /**
     * The minimum number of characters for the text field.
     */
    public val minLength: kotlin.Int = requireNotNull(builder.minLength) { "A non-null value must be provided for minLength" }
    /**
     * The regular expression used to validate the text field.
     */
    public val pattern: kotlin.String = requireNotNull(builder.pattern) { "A non-null value must be provided for pattern" }

    public companion object {
        public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.pinpointsmsvoicev2.model.TextValidation = Builder().apply(block).build()
    }

    override fun toString(): kotlin.String = buildString {
        append("TextValidation(")
        append("maxLength=$maxLength,")
        append("minLength=$minLength,")
        append("pattern=$pattern")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = maxLength
        result = 31 * result + (minLength)
        result = 31 * result + (pattern.hashCode())
        return result
    }

    override fun equals(other: kotlin.Any?): kotlin.Boolean {
        if (this === other) return true
        if (other == null || this::class != other::class) return false

        other as TextValidation

        if (maxLength != other.maxLength) return false
        if (minLength != other.minLength) return false
        if (pattern != other.pattern) return false

        return true
    }

    public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.pinpointsmsvoicev2.model.TextValidation = Builder(this).apply(block).build()

    @SdkDsl
    public class Builder {
        /**
         * The maximum number of characters for the text field.
         */
        public var maxLength: kotlin.Int? = null
        /**
         * The minimum number of characters for the text field.
         */
        public var minLength: kotlin.Int? = null
        /**
         * The regular expression used to validate the text field.
         */
        public var pattern: kotlin.String? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.pinpointsmsvoicev2.model.TextValidation) : this() {
            this.maxLength = x.maxLength
            this.minLength = x.minLength
            this.pattern = x.pattern
        }

        @PublishedApi
        internal fun build(): aws.sdk.kotlin.services.pinpointsmsvoicev2.model.TextValidation = TextValidation(this)

        internal fun correctErrors(): Builder {
            if (maxLength == null) maxLength = 0
            if (minLength == null) minLength = 0
            if (pattern == null) pattern = ""
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy