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

protokt.com.google.api.source_info.kt Maven / Gradle / Ivy

There is a newer version: 0.12.1
Show newest version
// Generated by protokt version 0.12.0. Do not modify.
// Source: google/api/source_info.proto
package com.google.api

import com.toasttab.protokt.Any
import com.toasttab.protokt.rt.KtDeserializer
import com.toasttab.protokt.rt.KtGeneratedMessage
import com.toasttab.protokt.rt.KtMessage
import com.toasttab.protokt.rt.KtMessageDeserializer
import com.toasttab.protokt.rt.KtMessageSerializer
import com.toasttab.protokt.rt.Tag
import com.toasttab.protokt.rt.UnknownFieldSet
import com.toasttab.protokt.rt.copyList
import com.toasttab.protokt.rt.finishList
import com.toasttab.protokt.rt.sizeof
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.MutableList

/**
 * Source information used to create a Service Config
 */
@KtGeneratedMessage("google.api.SourceInfo")
class SourceInfo private constructor(
    /**
     * All files used during config generation.
     */
    val sourceFiles: List,
    val unknownFields: UnknownFieldSet = UnknownFieldSet.empty(),
) : KtMessage {
    override val messageSize: Int by lazy { messageSize() }

    private fun messageSize(): Int {
        var result = 0
        if (sourceFiles.isNotEmpty()) {
            result += (sizeof(Tag(1)) * sourceFiles.size) + sourceFiles.sumOf { sizeof(it) } 
        }
        result += unknownFields.size()
        return result
    }

    override fun serialize(serializer: KtMessageSerializer) {
        if (sourceFiles.isNotEmpty()) {
            sourceFiles.forEach { serializer.write(Tag(10)).write(it) }
        }
        serializer.writeUnknown(unknownFields)
    }

    override fun equals(other: kotlin.Any?): Boolean = other is SourceInfo &&
        other.sourceFiles == sourceFiles &&
        other.unknownFields == unknownFields

    override fun hashCode(): Int {
        var result = unknownFields.hashCode()
        result = 31 * result + sourceFiles.hashCode()
        return result
    }

    override fun toString(): String = "SourceInfo(" +
        "sourceFiles=$sourceFiles" +
        "${if (unknownFields.isEmpty()) "" else ", unknownFields=$unknownFields"})"

    fun copy(dsl: SourceInfoDsl.() -> Unit): SourceInfo = SourceInfo.Deserializer {
        sourceFiles = [email protected]
        unknownFields = [email protected]
        dsl()
    }

    class SourceInfoDsl {
        var sourceFiles: List = emptyList()
            set(newValue) {
                field = copyList(newValue)
            }

        var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

        fun build(): SourceInfo = SourceInfo(finishList(sourceFiles),
         unknownFields)
    }

    companion object Deserializer : KtDeserializer,
            (SourceInfoDsl.() -> Unit) -> SourceInfo {
        override fun deserialize(deserializer: KtMessageDeserializer): SourceInfo {
            var sourceFiles : MutableList? = null
            var unknownFields: UnknownFieldSet.Builder? = null
            while (true) {
                when(deserializer.readTag()) {
                    0 -> return SourceInfo(finishList(sourceFiles),
                            UnknownFieldSet.from(unknownFields))
                    10 -> sourceFiles = (sourceFiles ?: mutableListOf()).apply {
                                   deserializer.readRepeated(false) {
                                       add(deserializer.readMessage(com.toasttab.protokt.Any))
                                   }
                               }
                    else -> unknownFields = (unknownFields ?:
                            UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
                }
            }
        }

        override fun invoke(dsl: SourceInfoDsl.() -> Unit): SourceInfo =
                SourceInfoDsl().apply(dsl).build()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy