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

commonMain.aws.sdk.kotlin.services.cloudsearch.model.Expression.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.cloudsearch.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * A named expression that can be evaluated at search time. Can be used to sort the search results, define other expressions, or return computed information in the search results.
 */
public class Expression private constructor(builder: Builder) {
    /**
     * Names must begin with a letter and can contain the following characters: a-z (lowercase), 0-9, and _ (underscore).
     */
    public val expressionName: kotlin.String = requireNotNull(builder.expressionName) { "A non-null value must be provided for expressionName" }
    /**
     * The expression to evaluate for sorting while processing a search request. The `Expression` syntax is based on JavaScript expressions. For more information, see [Configuring Expressions](http://docs.aws.amazon.com/cloudsearch/latest/developerguide/configuring-expressions.html) in the *Amazon CloudSearch Developer Guide*.
     */
    public val expressionValue: kotlin.String = requireNotNull(builder.expressionValue) { "A non-null value must be provided for expressionValue" }

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

    override fun toString(): kotlin.String = buildString {
        append("Expression(")
        append("expressionName=$expressionName,")
        append("expressionValue=$expressionValue")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = expressionName.hashCode()
        result = 31 * result + (expressionValue.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 Expression

        if (expressionName != other.expressionName) return false
        if (expressionValue != other.expressionValue) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * Names must begin with a letter and can contain the following characters: a-z (lowercase), 0-9, and _ (underscore).
         */
        public var expressionName: kotlin.String? = null
        /**
         * The expression to evaluate for sorting while processing a search request. The `Expression` syntax is based on JavaScript expressions. For more information, see [Configuring Expressions](http://docs.aws.amazon.com/cloudsearch/latest/developerguide/configuring-expressions.html) in the *Amazon CloudSearch Developer Guide*.
         */
        public var expressionValue: kotlin.String? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.cloudsearch.model.Expression) : this() {
            this.expressionName = x.expressionName
            this.expressionValue = x.expressionValue
        }

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

        internal fun correctErrors(): Builder {
            if (expressionName == null) expressionName = ""
            if (expressionValue == null) expressionValue = ""
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy