commonMain.protokt.v1.google.api.label.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of proto-google-common-protos-lite Show documentation
Show all versions of proto-google-common-protos-lite Show documentation
Protobuf compiler and runtime for Kotlin
The newest version!
// Generated by protokt version 1.0.0-beta.2. Do not modify.
// Source: google/api/label.proto
@file:Suppress("DEPRECATION")
package protokt.v1.google.api
import protokt.v1.AbstractDeserializer
import protokt.v1.AbstractMessage
import protokt.v1.BuilderDsl
import protokt.v1.Enum
import protokt.v1.EnumReader
import protokt.v1.GeneratedMessage
import protokt.v1.GeneratedProperty
import protokt.v1.Reader
import protokt.v1.SizeCodecs.sizeOf
import protokt.v1.UnknownFieldSet
import protokt.v1.Writer
import kotlin.Any
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.jvm.JvmStatic
/**
* A description of a label.
*/
@GeneratedMessage("google.api.LabelDescriptor")
public class LabelDescriptor private constructor(
/**
* The label key.
*/
@GeneratedProperty(1)
public val key: String,
/**
* The type of data that can be assigned to the label.
*/
@GeneratedProperty(2)
public val valueType: ValueType,
/**
* A human-readable description for the label.
*/
@GeneratedProperty(3)
public val description: String,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractMessage() {
private val `$messageSize`: Int by lazy {
var result = 0
if (key.isNotEmpty()) {
result += sizeOf(10u) + sizeOf(key)
}
if (valueType.value != 0) {
result += sizeOf(16u) + sizeOf(valueType)
}
if (description.isNotEmpty()) {
result += sizeOf(26u) + sizeOf(description)
}
result += unknownFields.size()
result
}
override fun messageSize(): Int = `$messageSize`
override fun serialize(writer: Writer) {
if (key.isNotEmpty()) {
writer.writeTag(10u).write(key)
}
if (valueType.value != 0) {
writer.writeTag(16u).write(valueType)
}
if (description.isNotEmpty()) {
writer.writeTag(26u).write(description)
}
writer.writeUnknown(unknownFields)
}
override fun equals(other: Any?): Boolean =
other is LabelDescriptor &&
other.key == key &&
other.valueType == valueType &&
other.description == description &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + key.hashCode()
result = 31 * result + valueType.hashCode()
result = 31 * result + description.hashCode()
return result
}
override fun toString(): String =
"LabelDescriptor(" +
"key=$key, " +
"valueType=$valueType, " +
"description=$description" +
if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"
public fun copy(builder: Builder.() -> Unit): LabelDescriptor =
Builder().apply {
key = [email protected]
valueType = [email protected]
description = [email protected]
unknownFields = [email protected]
builder()
}.build()
@BuilderDsl
public class Builder {
public var key: String = ""
public var valueType: ValueType = ValueType.from(0)
public var description: String = ""
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): LabelDescriptor =
LabelDescriptor(
key,
valueType,
description,
unknownFields
)
}
public companion object Deserializer : AbstractDeserializer() {
@JvmStatic
override fun deserialize(reader: Reader): LabelDescriptor {
var key = ""
var valueType = ValueType.from(0)
var description = ""
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (reader.readTag()) {
0u -> return LabelDescriptor(
key,
valueType,
description,
UnknownFieldSet.from(unknownFields)
)
10u -> key = reader.readString()
16u -> valueType = reader.readEnum(ValueType)
26u -> description = reader.readString()
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(reader.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): LabelDescriptor = Builder().apply(dsl).build()
}
/**
* Value types that can be used as label values.
*/
public sealed class ValueType(
override val `value`: Int,
override val name: String
) : Enum() {
/**
* A variable-length string. This is the default.
*/
public object STRING : ValueType(0, "STRING")
/**
* Boolean; true or false.
*/
public object BOOL : ValueType(1, "BOOL")
/**
* A 64-bit signed integer.
*/
public object INT64 : ValueType(2, "INT64")
public class UNRECOGNIZED(
`value`: Int
) : ValueType(value, "UNRECOGNIZED")
public companion object Deserializer : EnumReader {
override fun from(`value`: Int): ValueType =
when (value) {
0 -> STRING
1 -> BOOL
2 -> INT64
else -> UNRECOGNIZED(value)
}
}
}
}