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

com.slack.sgp.tracing.KeyValue.kt Maven / Gradle / Ivy

// Code generated by Wire protocol buffer compiler, do not edit.
// Source: trace.KeyValue in trace.proto
@file:Suppress(
  "DEPRECATION",
  "RUNTIME_ANNOTATION_NOT_SUPPORTED",
)

package com.slack.sgp.tracing

import com.squareup.wire.FieldEncoding
import com.squareup.wire.Message
import com.squareup.wire.ProtoAdapter
import com.squareup.wire.ProtoReader
import com.squareup.wire.ProtoWriter
import com.squareup.wire.ReverseProtoWriter
import com.squareup.wire.Syntax.PROTO_3
import com.squareup.wire.WireField
import com.squareup.wire.`internal`.JvmField
import com.squareup.wire.`internal`.sanitize
import kotlin.Any
import kotlin.AssertionError
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.DeprecationLevel
import kotlin.Double
import kotlin.Int
import kotlin.Long
import kotlin.Nothing
import kotlin.String
import kotlin.Suppress
import okio.ByteString

public class KeyValue(
  @field:WireField(
    tag = 1,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
    label = WireField.Label.OMIT_IDENTITY,
    schemaIndex = 0,
  )
  public val key: String = "",
  @field:WireField(
    tag = 2,
    adapter = "com.slack.sgp.tracing.ValueType#ADAPTER",
    label = WireField.Label.OMIT_IDENTITY,
    jsonName = "vType",
    schemaIndex = 1,
  )
  public val v_type: ValueType = ValueType.STRING,
  @field:WireField(
    tag = 3,
    adapter = "com.squareup.wire.ProtoAdapter#STRING",
    label = WireField.Label.OMIT_IDENTITY,
    jsonName = "vStr",
    schemaIndex = 2,
  )
  public val v_str: String = "",
  @field:WireField(
    tag = 4,
    adapter = "com.squareup.wire.ProtoAdapter#BOOL",
    label = WireField.Label.OMIT_IDENTITY,
    jsonName = "vBool",
    schemaIndex = 3,
  )
  public val v_bool: Boolean = false,
  @field:WireField(
    tag = 5,
    adapter = "com.squareup.wire.ProtoAdapter#INT64",
    label = WireField.Label.OMIT_IDENTITY,
    jsonName = "vInt64",
    schemaIndex = 4,
  )
  public val v_int64: Long = 0L,
  @field:WireField(
    tag = 6,
    adapter = "com.squareup.wire.ProtoAdapter#DOUBLE",
    label = WireField.Label.OMIT_IDENTITY,
    jsonName = "vFloat64",
    schemaIndex = 5,
  )
  public val v_float64: Double = 0.0,
  @field:WireField(
    tag = 7,
    adapter = "com.squareup.wire.ProtoAdapter#BYTES",
    label = WireField.Label.OMIT_IDENTITY,
    jsonName = "vBinary",
    schemaIndex = 6,
  )
  public val v_binary: ByteString = ByteString.EMPTY,
  unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
  @Deprecated(
    message = "Shouldn't be used in Kotlin",
    level = DeprecationLevel.HIDDEN,
  )
  override fun newBuilder(): Nothing = throw
      AssertionError("Builders are deprecated and only available in a javaInterop build; see https://square.github.io/wire/wire_compiler/#kotlin")

  override fun equals(other: Any?): Boolean {
    if (other === this) return true
    if (other !is KeyValue) return false
    if (unknownFields != other.unknownFields) return false
    if (key != other.key) return false
    if (v_type != other.v_type) return false
    if (v_str != other.v_str) return false
    if (v_bool != other.v_bool) return false
    if (v_int64 != other.v_int64) return false
    if (v_float64 != other.v_float64) return false
    if (v_binary != other.v_binary) return false
    return true
  }

  override fun hashCode(): Int {
    var result = super.hashCode
    if (result == 0) {
      result = unknownFields.hashCode()
      result = result * 37 + key.hashCode()
      result = result * 37 + v_type.hashCode()
      result = result * 37 + v_str.hashCode()
      result = result * 37 + v_bool.hashCode()
      result = result * 37 + v_int64.hashCode()
      result = result * 37 + v_float64.hashCode()
      result = result * 37 + v_binary.hashCode()
      super.hashCode = result
    }
    return result
  }

  override fun toString(): String {
    val result = mutableListOf()
    result += """key=${sanitize(key)}"""
    result += """v_type=$v_type"""
    result += """v_str=${sanitize(v_str)}"""
    result += """v_bool=$v_bool"""
    result += """v_int64=$v_int64"""
    result += """v_float64=$v_float64"""
    result += """v_binary=$v_binary"""
    return result.joinToString(prefix = "KeyValue{", separator = ", ", postfix = "}")
  }

  public fun copy(
    key: String = this.key,
    v_type: ValueType = this.v_type,
    v_str: String = this.v_str,
    v_bool: Boolean = this.v_bool,
    v_int64: Long = this.v_int64,
    v_float64: Double = this.v_float64,
    v_binary: ByteString = this.v_binary,
    unknownFields: ByteString = this.unknownFields,
  ): KeyValue = KeyValue(key, v_type, v_str, v_bool, v_int64, v_float64, v_binary, unknownFields)

  public companion object {
    @JvmField
    public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
      FieldEncoding.LENGTH_DELIMITED, 
      KeyValue::class, 
      "type.googleapis.com/trace.KeyValue", 
      PROTO_3, 
      null, 
      "trace.proto"
    ) {
      override fun encodedSize(`value`: KeyValue): Int {
        var size = value.unknownFields.size
        if (value.key != "") {
          size += ProtoAdapter.STRING.encodedSizeWithTag(1, value.key)
        }
        if (value.v_type != com.slack.sgp.tracing.ValueType.STRING) {
          size += ValueType.ADAPTER.encodedSizeWithTag(2, value.v_type)
        }
        if (value.v_str != "") {
          size += ProtoAdapter.STRING.encodedSizeWithTag(3, value.v_str)
        }
        if (value.v_bool != false) {
          size += ProtoAdapter.BOOL.encodedSizeWithTag(4, value.v_bool)
        }
        if (value.v_int64 != 0L) {
          size += ProtoAdapter.INT64.encodedSizeWithTag(5, value.v_int64)
        }
        if (!value.v_float64.equals(0.0)) {
          size += ProtoAdapter.DOUBLE.encodedSizeWithTag(6, value.v_float64)
        }
        if (value.v_binary != okio.ByteString.EMPTY) {
          size += ProtoAdapter.BYTES.encodedSizeWithTag(7, value.v_binary)
        }
        return size
      }

      override fun encode(writer: ProtoWriter, `value`: KeyValue) {
        if (value.key != "") {
          ProtoAdapter.STRING.encodeWithTag(writer, 1, value.key)
        }
        if (value.v_type != com.slack.sgp.tracing.ValueType.STRING) {
          ValueType.ADAPTER.encodeWithTag(writer, 2, value.v_type)
        }
        if (value.v_str != "") {
          ProtoAdapter.STRING.encodeWithTag(writer, 3, value.v_str)
        }
        if (value.v_bool != false) {
          ProtoAdapter.BOOL.encodeWithTag(writer, 4, value.v_bool)
        }
        if (value.v_int64 != 0L) {
          ProtoAdapter.INT64.encodeWithTag(writer, 5, value.v_int64)
        }
        if (!value.v_float64.equals(0.0)) {
          ProtoAdapter.DOUBLE.encodeWithTag(writer, 6, value.v_float64)
        }
        if (value.v_binary != okio.ByteString.EMPTY) {
          ProtoAdapter.BYTES.encodeWithTag(writer, 7, value.v_binary)
        }
        writer.writeBytes(value.unknownFields)
      }

      override fun encode(writer: ReverseProtoWriter, `value`: KeyValue) {
        writer.writeBytes(value.unknownFields)
        if (value.v_binary != okio.ByteString.EMPTY) {
          ProtoAdapter.BYTES.encodeWithTag(writer, 7, value.v_binary)
        }
        if (!value.v_float64.equals(0.0)) {
          ProtoAdapter.DOUBLE.encodeWithTag(writer, 6, value.v_float64)
        }
        if (value.v_int64 != 0L) {
          ProtoAdapter.INT64.encodeWithTag(writer, 5, value.v_int64)
        }
        if (value.v_bool != false) {
          ProtoAdapter.BOOL.encodeWithTag(writer, 4, value.v_bool)
        }
        if (value.v_str != "") {
          ProtoAdapter.STRING.encodeWithTag(writer, 3, value.v_str)
        }
        if (value.v_type != com.slack.sgp.tracing.ValueType.STRING) {
          ValueType.ADAPTER.encodeWithTag(writer, 2, value.v_type)
        }
        if (value.key != "") {
          ProtoAdapter.STRING.encodeWithTag(writer, 1, value.key)
        }
      }

      override fun decode(reader: ProtoReader): KeyValue {
        var key: String = ""
        var v_type: ValueType = ValueType.STRING
        var v_str: String = ""
        var v_bool: Boolean = false
        var v_int64: Long = 0L
        var v_float64: Double = 0.0
        var v_binary: ByteString = ByteString.EMPTY
        val unknownFields = reader.forEachTag { tag ->
          when (tag) {
            1 -> key = ProtoAdapter.STRING.decode(reader)
            2 -> try {
              v_type = ValueType.ADAPTER.decode(reader)
            } catch (e: ProtoAdapter.EnumConstantNotFoundException) {
              reader.addUnknownField(tag, FieldEncoding.VARINT, e.value.toLong())
            }
            3 -> v_str = ProtoAdapter.STRING.decode(reader)
            4 -> v_bool = ProtoAdapter.BOOL.decode(reader)
            5 -> v_int64 = ProtoAdapter.INT64.decode(reader)
            6 -> v_float64 = ProtoAdapter.DOUBLE.decode(reader)
            7 -> v_binary = ProtoAdapter.BYTES.decode(reader)
            else -> reader.readUnknownField(tag)
          }
        }
        return KeyValue(
          key = key,
          v_type = v_type,
          v_str = v_str,
          v_bool = v_bool,
          v_int64 = v_int64,
          v_float64 = v_float64,
          v_binary = v_binary,
          unknownFields = unknownFields
        )
      }

      override fun redact(`value`: KeyValue): KeyValue = value.copy(
        unknownFields = ByteString.EMPTY
      )
    }

    private const val serialVersionUID: Long = 0L
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy