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

org.whispersystems.signalservice.internal.push.EditMessage.kt Maven / Gradle / Ivy

There is a newer version: 2.15.3_unofficial_107
Show newest version
// Code generated by Wire protocol buffer compiler, do not edit.
// Source: signalservice.EditMessage in SignalService.proto
package org.whispersystems.signalservice.`internal`.push

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_2
import com.squareup.wire.WireField
import kotlin.Any
import kotlin.Boolean
import kotlin.Int
import kotlin.Long
import kotlin.String
import kotlin.Unit
import kotlin.jvm.JvmField
import okio.ByteString

public class EditMessage(
  @field:WireField(
    tag = 1,
    adapter = "com.squareup.wire.ProtoAdapter#UINT64",
  )
  @JvmField
  public val targetSentTimestamp: Long? = null,
  @field:WireField(
    tag = 2,
    adapter = "org.whispersystems.signalservice.internal.push.DataMessage#ADAPTER",
  )
  @JvmField
  public val dataMessage: DataMessage? = null,
  unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
  public override fun newBuilder(): Builder {
    val builder = Builder()
    builder.targetSentTimestamp = targetSentTimestamp
    builder.dataMessage = dataMessage
    builder.addUnknownFields(unknownFields)
    return builder
  }

  public override fun equals(other: Any?): Boolean {
    if (other === this) return true
    if (other !is EditMessage) return false
    if (unknownFields != other.unknownFields) return false
    if (targetSentTimestamp != other.targetSentTimestamp) return false
    if (dataMessage != other.dataMessage) return false
    return true
  }

  public override fun hashCode(): Int {
    var result = super.hashCode
    if (result == 0) {
      result = unknownFields.hashCode()
      result = result * 37 + (targetSentTimestamp?.hashCode() ?: 0)
      result = result * 37 + (dataMessage?.hashCode() ?: 0)
      super.hashCode = result
    }
    return result
  }

  public override fun toString(): String {
    val result = mutableListOf()
    if (targetSentTimestamp != null) result += """targetSentTimestamp=$targetSentTimestamp"""
    if (dataMessage != null) result += """dataMessage=$dataMessage"""
    return result.joinToString(prefix = "EditMessage{", separator = ", ", postfix = "}")
  }

  public fun copy(
    targetSentTimestamp: Long? = this.targetSentTimestamp,
    dataMessage: DataMessage? = this.dataMessage,
    unknownFields: ByteString = this.unknownFields,
  ): EditMessage = EditMessage(targetSentTimestamp, dataMessage, unknownFields)

  public class Builder : Message.Builder() {
    @JvmField
    public var targetSentTimestamp: Long? = null

    @JvmField
    public var dataMessage: DataMessage? = null

    public fun targetSentTimestamp(targetSentTimestamp: Long?): Builder {
      this.targetSentTimestamp = targetSentTimestamp
      return this
    }

    public fun dataMessage(dataMessage: DataMessage?): Builder {
      this.dataMessage = dataMessage
      return this
    }

    public override fun build(): EditMessage = EditMessage(
      targetSentTimestamp = targetSentTimestamp,
      dataMessage = dataMessage,
      unknownFields = buildUnknownFields()
    )
  }

  public companion object {
    @JvmField
    public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
      FieldEncoding.LENGTH_DELIMITED, 
      EditMessage::class, 
      "type.googleapis.com/signalservice.EditMessage", 
      PROTO_2, 
      null, 
      "SignalService.proto"
    ) {
      public override fun encodedSize(`value`: EditMessage): Int {
        var size = value.unknownFields.size
        size += ProtoAdapter.UINT64.encodedSizeWithTag(1, value.targetSentTimestamp)
        size += DataMessage.ADAPTER.encodedSizeWithTag(2, value.dataMessage)
        return size
      }

      public override fun encode(writer: ProtoWriter, `value`: EditMessage): Unit {
        ProtoAdapter.UINT64.encodeWithTag(writer, 1, value.targetSentTimestamp)
        DataMessage.ADAPTER.encodeWithTag(writer, 2, value.dataMessage)
        writer.writeBytes(value.unknownFields)
      }

      public override fun encode(writer: ReverseProtoWriter, `value`: EditMessage): Unit {
        writer.writeBytes(value.unknownFields)
        DataMessage.ADAPTER.encodeWithTag(writer, 2, value.dataMessage)
        ProtoAdapter.UINT64.encodeWithTag(writer, 1, value.targetSentTimestamp)
      }

      public override fun decode(reader: ProtoReader): EditMessage {
        var targetSentTimestamp: Long? = null
        var dataMessage: DataMessage? = null
        val unknownFields = reader.forEachTag { tag ->
          when (tag) {
            1 -> targetSentTimestamp = ProtoAdapter.UINT64.decode(reader)
            2 -> dataMessage = DataMessage.ADAPTER.decode(reader)
            else -> reader.readUnknownField(tag)
          }
        }
        return EditMessage(
          targetSentTimestamp = targetSentTimestamp,
          dataMessage = dataMessage,
          unknownFields = unknownFields
        )
      }

      public override fun redact(`value`: EditMessage): EditMessage = value.copy(
        dataMessage = value.dataMessage?.let(DataMessage.ADAPTER::redact),
        unknownFields = ByteString.EMPTY
      )
    }

    private const val serialVersionUID: Long = 0L
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy