commonMain.aws.sdk.kotlin.services.kendra.model.Highlight.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kendra-jvm Show documentation
Show all versions of kendra-jvm Show documentation
The AWS SDK for Kotlin client for kendra
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.kendra.model
import aws.smithy.kotlin.runtime.SdkDsl
/**
* Provides information that you can use to highlight a search result so that your users can quickly identify terms in the response.
*/
public class Highlight private constructor(builder: Builder) {
/**
* The zero-based location in the response string where the highlight starts.
*/
public val beginOffset: kotlin.Int = requireNotNull(builder.beginOffset) { "A non-null value must be provided for beginOffset" }
/**
* The zero-based location in the response string where the highlight ends.
*/
public val endOffset: kotlin.Int = requireNotNull(builder.endOffset) { "A non-null value must be provided for endOffset" }
/**
* Indicates whether the response is the best response. True if this is the best response; otherwise, false.
*/
public val topAnswer: kotlin.Boolean = builder.topAnswer
/**
* The highlight type.
*/
public val type: aws.sdk.kotlin.services.kendra.model.HighlightType? = builder.type
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.kendra.model.Highlight = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("Highlight(")
append("beginOffset=$beginOffset,")
append("endOffset=$endOffset,")
append("topAnswer=$topAnswer,")
append("type=$type")
append(")")
}
override fun hashCode(): kotlin.Int {
var result = beginOffset
result = 31 * result + (endOffset)
result = 31 * result + (topAnswer.hashCode())
result = 31 * result + (type?.hashCode() ?: 0)
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 Highlight
if (beginOffset != other.beginOffset) return false
if (endOffset != other.endOffset) return false
if (topAnswer != other.topAnswer) return false
if (type != other.type) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.kendra.model.Highlight = Builder(this).apply(block).build()
@SdkDsl
public class Builder {
/**
* The zero-based location in the response string where the highlight starts.
*/
public var beginOffset: kotlin.Int? = null
/**
* The zero-based location in the response string where the highlight ends.
*/
public var endOffset: kotlin.Int? = null
/**
* Indicates whether the response is the best response. True if this is the best response; otherwise, false.
*/
public var topAnswer: kotlin.Boolean = false
/**
* The highlight type.
*/
public var type: aws.sdk.kotlin.services.kendra.model.HighlightType? = null
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.kendra.model.Highlight) : this() {
this.beginOffset = x.beginOffset
this.endOffset = x.endOffset
this.topAnswer = x.topAnswer
this.type = x.type
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.kendra.model.Highlight = Highlight(this)
internal fun correctErrors(): Builder {
if (beginOffset == null) beginOffset = 0
if (endOffset == null) endOffset = 0
return this
}
}
}