
commonMain.aws.sdk.kotlin.services.pi.model.DataPoint.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.pi.model
import aws.smithy.kotlin.runtime.SdkDsl
import aws.smithy.kotlin.runtime.time.Instant
/**
* A timestamp, and a single numerical value, which together represent a measurement at a particular point in time.
*/
public class DataPoint private constructor(builder: Builder) {
/**
* The time, in epoch format, associated with a particular `Value`.
*/
public val timestamp: aws.smithy.kotlin.runtime.time.Instant = requireNotNull(builder.timestamp) { "A non-null value must be provided for timestamp" }
/**
* The actual value associated with a particular `Timestamp`.
*/
public val value: kotlin.Double = requireNotNull(builder.value) { "A non-null value must be provided for value" }
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.pi.model.DataPoint = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("DataPoint(")
append("timestamp=$timestamp,")
append("value=$value")
append(")")
}
override fun hashCode(): kotlin.Int {
var result = timestamp.hashCode()
result = 31 * result + (value.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 DataPoint
if (timestamp != other.timestamp) return false
if (!(value?.equals(other.value) ?: (other.value == null))) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.pi.model.DataPoint = Builder(this).apply(block).build()
@SdkDsl
public class Builder {
/**
* The time, in epoch format, associated with a particular `Value`.
*/
public var timestamp: aws.smithy.kotlin.runtime.time.Instant? = null
/**
* The actual value associated with a particular `Timestamp`.
*/
public var value: kotlin.Double? = null
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.pi.model.DataPoint) : this() {
this.timestamp = x.timestamp
this.value = x.value
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.pi.model.DataPoint = DataPoint(this)
internal fun correctErrors(): Builder {
if (timestamp == null) timestamp = Instant.fromEpochSeconds(0)
if (value == null) value = 0.0
return this
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy