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

commonMain.aws.sdk.kotlin.services.glue.model.DecimalNumber.kt Maven / Gradle / Ivy

// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.glue.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * Contains a numeric value in decimal format.
 */
public class DecimalNumber private constructor(builder: Builder) {
    /**
     * The scale that determines where the decimal point falls in the unscaled value.
     */
    public val scale: kotlin.Int = builder.scale
    /**
     * The unscaled numeric value.
     */
    public val unscaledValue: kotlin.ByteArray = requireNotNull(builder.unscaledValue) { "A non-null value must be provided for unscaledValue" }

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

    override fun toString(): kotlin.String = buildString {
        append("DecimalNumber(")
        append("scale=$scale,")
        append("unscaledValue=$unscaledValue")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = scale
        result = 31 * result + (unscaledValue.contentHashCode())
        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 DecimalNumber

        if (scale != other.scale) return false
        if (unscaledValue != null) {
            if (other.unscaledValue == null) return false
            if (!unscaledValue.contentEquals(other.unscaledValue)) return false
        } else if (other.unscaledValue != null) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The scale that determines where the decimal point falls in the unscaled value.
         */
        public var scale: kotlin.Int = 0
        /**
         * The unscaled numeric value.
         */
        public var unscaledValue: kotlin.ByteArray? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.glue.model.DecimalNumber) : this() {
            this.scale = x.scale
            this.unscaledValue = x.unscaledValue
        }

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

        internal fun correctErrors(): Builder {
            if (unscaledValue == null) unscaledValue = ByteArray(0)
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy