org.whispersystems.signalservice.internal.sticker.Pack.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of signal-service-java Show documentation
Show all versions of signal-service-java Show documentation
Signal Service communication library for Java, unofficial fork
// Code generated by Wire protocol buffer compiler, do not edit.
// Source: signalservice.Pack in StickerResources.proto
package org.whispersystems.signalservice.`internal`.sticker
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
import com.squareup.wire.Syntax.PROTO_2
import com.squareup.wire.WireField
import com.squareup.wire.`internal`.checkElementsNotNull
import com.squareup.wire.`internal`.immutableCopyOf
import com.squareup.wire.`internal`.redactElements
import com.squareup.wire.`internal`.sanitize
import kotlin.Any
import kotlin.Boolean
import kotlin.Int
import kotlin.Long
import kotlin.String
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmField
import okio.ByteString
public class Pack(
@field:WireField(
tag = 1,
adapter = "com.squareup.wire.ProtoAdapter#STRING",
)
@JvmField
public val title: String? = null,
@field:WireField(
tag = 2,
adapter = "com.squareup.wire.ProtoAdapter#STRING",
)
@JvmField
public val author: String? = null,
@field:WireField(
tag = 3,
adapter = "org.whispersystems.signalservice.internal.sticker.Pack${'$'}Sticker#ADAPTER",
)
@JvmField
public val cover: Sticker? = null,
stickers: List = emptyList(),
unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
@field:WireField(
tag = 4,
adapter = "org.whispersystems.signalservice.internal.sticker.Pack${'$'}Sticker#ADAPTER",
label = WireField.Label.REPEATED,
)
@JvmField
public val stickers: List = immutableCopyOf("stickers", stickers)
public override fun newBuilder(): Builder {
val builder = Builder()
builder.title = title
builder.author = author
builder.cover = cover
builder.stickers = stickers
builder.addUnknownFields(unknownFields)
return builder
}
public override fun equals(other: Any?): Boolean {
if (other === this) return true
if (other !is Pack) return false
if (unknownFields != other.unknownFields) return false
if (title != other.title) return false
if (author != other.author) return false
if (cover != other.cover) return false
if (stickers != other.stickers) return false
return true
}
public override fun hashCode(): Int {
var result = super.hashCode
if (result == 0) {
result = unknownFields.hashCode()
result = result * 37 + (title?.hashCode() ?: 0)
result = result * 37 + (author?.hashCode() ?: 0)
result = result * 37 + (cover?.hashCode() ?: 0)
result = result * 37 + stickers.hashCode()
super.hashCode = result
}
return result
}
public override fun toString(): String {
val result = mutableListOf()
if (title != null) result += """title=${sanitize(title)}"""
if (author != null) result += """author=${sanitize(author)}"""
if (cover != null) result += """cover=$cover"""
if (stickers.isNotEmpty()) result += """stickers=$stickers"""
return result.joinToString(prefix = "Pack{", separator = ", ", postfix = "}")
}
public fun copy(
title: String? = this.title,
author: String? = this.author,
cover: Sticker? = this.cover,
stickers: List = this.stickers,
unknownFields: ByteString = this.unknownFields,
): Pack = Pack(title, author, cover, stickers, unknownFields)
public class Builder : Message.Builder() {
@JvmField
public var title: String? = null
@JvmField
public var author: String? = null
@JvmField
public var cover: Sticker? = null
@JvmField
public var stickers: List = emptyList()
public fun title(title: String?): Builder {
this.title = title
return this
}
public fun author(author: String?): Builder {
this.author = author
return this
}
public fun cover(cover: Sticker?): Builder {
this.cover = cover
return this
}
public fun stickers(stickers: List): Builder {
checkElementsNotNull(stickers)
this.stickers = stickers
return this
}
public override fun build(): Pack = Pack(
title = title,
author = author,
cover = cover,
stickers = stickers,
unknownFields = buildUnknownFields()
)
}
public companion object {
@JvmField
public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
FieldEncoding.LENGTH_DELIMITED,
Pack::class,
"type.googleapis.com/signalservice.Pack",
PROTO_2,
null,
"StickerResources.proto"
) {
public override fun encodedSize(`value`: Pack): Int {
var size = value.unknownFields.size
size += ProtoAdapter.STRING.encodedSizeWithTag(1, value.title)
size += ProtoAdapter.STRING.encodedSizeWithTag(2, value.author)
size += Sticker.ADAPTER.encodedSizeWithTag(3, value.cover)
size += Sticker.ADAPTER.asRepeated().encodedSizeWithTag(4, value.stickers)
return size
}
public override fun encode(writer: ProtoWriter, `value`: Pack): Unit {
ProtoAdapter.STRING.encodeWithTag(writer, 1, value.title)
ProtoAdapter.STRING.encodeWithTag(writer, 2, value.author)
Sticker.ADAPTER.encodeWithTag(writer, 3, value.cover)
Sticker.ADAPTER.asRepeated().encodeWithTag(writer, 4, value.stickers)
writer.writeBytes(value.unknownFields)
}
public override fun encode(writer: ReverseProtoWriter, `value`: Pack): Unit {
writer.writeBytes(value.unknownFields)
Sticker.ADAPTER.asRepeated().encodeWithTag(writer, 4, value.stickers)
Sticker.ADAPTER.encodeWithTag(writer, 3, value.cover)
ProtoAdapter.STRING.encodeWithTag(writer, 2, value.author)
ProtoAdapter.STRING.encodeWithTag(writer, 1, value.title)
}
public override fun decode(reader: ProtoReader): Pack {
var title: String? = null
var author: String? = null
var cover: Sticker? = null
val stickers = mutableListOf()
val unknownFields = reader.forEachTag { tag ->
when (tag) {
1 -> title = ProtoAdapter.STRING.decode(reader)
2 -> author = ProtoAdapter.STRING.decode(reader)
3 -> cover = Sticker.ADAPTER.decode(reader)
4 -> stickers.add(Sticker.ADAPTER.decode(reader))
else -> reader.readUnknownField(tag)
}
}
return Pack(
title = title,
author = author,
cover = cover,
stickers = stickers,
unknownFields = unknownFields
)
}
public override fun redact(`value`: Pack): Pack = value.copy(
cover = value.cover?.let(Sticker.ADAPTER::redact),
stickers = value.stickers.redactElements(Sticker.ADAPTER),
unknownFields = ByteString.EMPTY
)
}
private const val serialVersionUID: Long = 0L
}
public class Sticker(
@field:WireField(
tag = 1,
adapter = "com.squareup.wire.ProtoAdapter#UINT32",
)
@JvmField
public val id: Int? = null,
@field:WireField(
tag = 2,
adapter = "com.squareup.wire.ProtoAdapter#STRING",
)
@JvmField
public val emoji: String? = null,
@field:WireField(
tag = 3,
adapter = "com.squareup.wire.ProtoAdapter#STRING",
)
@JvmField
public val contentType: String? = null,
unknownFields: ByteString = ByteString.EMPTY,
) : Message(ADAPTER, unknownFields) {
public override fun newBuilder(): Builder {
val builder = Builder()
builder.id = id
builder.emoji = emoji
builder.contentType = contentType
builder.addUnknownFields(unknownFields)
return builder
}
public override fun equals(other: Any?): Boolean {
if (other === this) return true
if (other !is Sticker) return false
if (unknownFields != other.unknownFields) return false
if (id != other.id) return false
if (emoji != other.emoji) return false
if (contentType != other.contentType) return false
return true
}
public override fun hashCode(): Int {
var result = super.hashCode
if (result == 0) {
result = unknownFields.hashCode()
result = result * 37 + (id?.hashCode() ?: 0)
result = result * 37 + (emoji?.hashCode() ?: 0)
result = result * 37 + (contentType?.hashCode() ?: 0)
super.hashCode = result
}
return result
}
public override fun toString(): String {
val result = mutableListOf()
if (id != null) result += """id=$id"""
if (emoji != null) result += """emoji=${sanitize(emoji)}"""
if (contentType != null) result += """contentType=${sanitize(contentType)}"""
return result.joinToString(prefix = "Sticker{", separator = ", ", postfix = "}")
}
public fun copy(
id: Int? = this.id,
emoji: String? = this.emoji,
contentType: String? = this.contentType,
unknownFields: ByteString = this.unknownFields,
): Sticker = Sticker(id, emoji, contentType, unknownFields)
public class Builder : Message.Builder() {
@JvmField
public var id: Int? = null
@JvmField
public var emoji: String? = null
@JvmField
public var contentType: String? = null
public fun id(id: Int?): Builder {
this.id = id
return this
}
public fun emoji(emoji: String?): Builder {
this.emoji = emoji
return this
}
public fun contentType(contentType: String?): Builder {
this.contentType = contentType
return this
}
public override fun build(): Sticker = Sticker(
id = id,
emoji = emoji,
contentType = contentType,
unknownFields = buildUnknownFields()
)
}
public companion object {
@JvmField
public val ADAPTER: ProtoAdapter = object : ProtoAdapter(
FieldEncoding.LENGTH_DELIMITED,
Sticker::class,
"type.googleapis.com/signalservice.Pack.Sticker",
PROTO_2,
null,
"StickerResources.proto"
) {
public override fun encodedSize(`value`: Sticker): Int {
var size = value.unknownFields.size
size += ProtoAdapter.UINT32.encodedSizeWithTag(1, value.id)
size += ProtoAdapter.STRING.encodedSizeWithTag(2, value.emoji)
size += ProtoAdapter.STRING.encodedSizeWithTag(3, value.contentType)
return size
}
public override fun encode(writer: ProtoWriter, `value`: Sticker): Unit {
ProtoAdapter.UINT32.encodeWithTag(writer, 1, value.id)
ProtoAdapter.STRING.encodeWithTag(writer, 2, value.emoji)
ProtoAdapter.STRING.encodeWithTag(writer, 3, value.contentType)
writer.writeBytes(value.unknownFields)
}
public override fun encode(writer: ReverseProtoWriter, `value`: Sticker): Unit {
writer.writeBytes(value.unknownFields)
ProtoAdapter.STRING.encodeWithTag(writer, 3, value.contentType)
ProtoAdapter.STRING.encodeWithTag(writer, 2, value.emoji)
ProtoAdapter.UINT32.encodeWithTag(writer, 1, value.id)
}
public override fun decode(reader: ProtoReader): Sticker {
var id: Int? = null
var emoji: String? = null
var contentType: String? = null
val unknownFields = reader.forEachTag { tag ->
when (tag) {
1 -> id = ProtoAdapter.UINT32.decode(reader)
2 -> emoji = ProtoAdapter.STRING.decode(reader)
3 -> contentType = ProtoAdapter.STRING.decode(reader)
else -> reader.readUnknownField(tag)
}
}
return Sticker(
id = id,
emoji = emoji,
contentType = contentType,
unknownFields = unknownFields
)
}
public override fun redact(`value`: Sticker): Sticker = value.copy(
unknownFields = ByteString.EMPTY
)
}
private const val serialVersionUID: Long = 0L
}
}
}