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

org.yupana.proto.ResultHeader.scala Maven / Gradle / Ivy

The newest version!
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO2

package org.yupana.proto

@SerialVersionUID(0L)
final case class ResultHeader(
    fields: _root_.scala.Seq[org.yupana.proto.ResultField] = _root_.scala.Seq.empty,
    tableName: _root_.scala.Option[_root_.scala.Predef.String] = _root_.scala.None
    ) extends scalapb.GeneratedMessage with scalapb.Message[ResultHeader] with scalapb.lenses.Updatable[ResultHeader] {
    @transient
    private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0
    private[this] def __computeSerializedValue(): _root_.scala.Int = {
      var __size = 0
      fields.foreach { __item =>
        val __value = __item
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      }
      if (tableName.isDefined) {
        val __value = tableName.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value)
      };
      __size
    }
    final override def serializedSize: _root_.scala.Int = {
      var read = __serializedSizeCachedValue
      if (read == 0) {
        read = __computeSerializedValue()
        __serializedSizeCachedValue = read
      }
      read
    }
    def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
      fields.foreach { __v =>
        val __m = __v
        _output__.writeTag(1, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      tableName.foreach { __v =>
        val __m = __v
        _output__.writeString(2, __m)
      };
    }
    def mergeFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): org.yupana.proto.ResultHeader = {
      val __fields = (_root_.scala.collection.immutable.Vector.newBuilder[org.yupana.proto.ResultField] ++= this.fields)
      var __tableName = this.tableName
      var _done__ = false
      while (!_done__) {
        val _tag__ = _input__.readTag()
        _tag__ match {
          case 0 => _done__ = true
          case 10 =>
            __fields += _root_.scalapb.LiteParser.readMessage(_input__, org.yupana.proto.ResultField.defaultInstance)
          case 18 =>
            __tableName = Option(_input__.readString())
          case tag => _input__.skipField(tag)
        }
      }
      org.yupana.proto.ResultHeader(
          fields = __fields.result(),
          tableName = __tableName
      )
    }
    def clearFields = copy(fields = _root_.scala.Seq.empty)
    def addFields(__vs: org.yupana.proto.ResultField*): ResultHeader = addAllFields(__vs)
    def addAllFields(__vs: Iterable[org.yupana.proto.ResultField]): ResultHeader = copy(fields = fields ++ __vs)
    def withFields(__v: _root_.scala.Seq[org.yupana.proto.ResultField]): ResultHeader = copy(fields = __v)
    def getTableName: _root_.scala.Predef.String = tableName.getOrElse("")
    def clearTableName: ResultHeader = copy(tableName = _root_.scala.None)
    def withTableName(__v: _root_.scala.Predef.String): ResultHeader = copy(tableName = Option(__v))
    def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
      (__fieldNumber: @_root_.scala.unchecked) match {
        case 1 => fields
        case 2 => tableName.orNull
      }
    }
    def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = {
      _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor)
      (__field.number: @_root_.scala.unchecked) match {
        case 1 => _root_.scalapb.descriptors.PRepeated(fields.iterator.map(_.toPMessage).toVector)
        case 2 => tableName.map(_root_.scalapb.descriptors.PString).getOrElse(_root_.scalapb.descriptors.PEmpty)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion = org.yupana.proto.ResultHeader
}

object ResultHeader extends scalapb.GeneratedMessageCompanion[org.yupana.proto.ResultHeader] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[org.yupana.proto.ResultHeader] = this
  def fromFieldsMap(__fieldsMap: scala.collection.immutable.Map[_root_.com.google.protobuf.Descriptors.FieldDescriptor, _root_.scala.Any]): org.yupana.proto.ResultHeader = {
    _root_.scala.Predef.require(__fieldsMap.keys.forall(_.getContainingType() == javaDescriptor), "FieldDescriptor does not match message type.")
    val __fields = javaDescriptor.getFields
    org.yupana.proto.ResultHeader(
      __fieldsMap.getOrElse(__fields.get(0), Nil).asInstanceOf[_root_.scala.Seq[org.yupana.proto.ResultField]],
      __fieldsMap.get(__fields.get(1)).asInstanceOf[_root_.scala.Option[_root_.scala.Predef.String]]
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[org.yupana.proto.ResultHeader] = _root_.scalapb.descriptors.Reads{
    case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
      _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage == scalaDescriptor), "FieldDescriptor does not match message type.")
      org.yupana.proto.ResultHeader(
        __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Seq[org.yupana.proto.ResultField]]).getOrElse(_root_.scala.Seq.empty),
        __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Predef.String]])
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ProtoProto.javaDescriptor.getMessageTypes.get(9)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ProtoProto.scalaDescriptor.messages(9)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 1 => __out = org.yupana.proto.ResultField
    }
    __out
  }
  lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
  lazy val defaultInstance = org.yupana.proto.ResultHeader(
    fields = _root_.scala.Seq.empty,
    tableName = _root_.scala.None
  )
  implicit class ResultHeaderLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, org.yupana.proto.ResultHeader]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, org.yupana.proto.ResultHeader](_l) {
    def fields: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[org.yupana.proto.ResultField]] = field(_.fields)((c_, f_) => c_.copy(fields = f_))
    def tableName: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.getTableName)((c_, f_) => c_.copy(tableName = Option(f_)))
    def optionalTableName: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[_root_.scala.Predef.String]] = field(_.tableName)((c_, f_) => c_.copy(tableName = f_))
  }
  final val FIELDS_FIELD_NUMBER = 1
  final val TABLENAME_FIELD_NUMBER = 2
  def of(
    fields: _root_.scala.Seq[org.yupana.proto.ResultField],
    tableName: _root_.scala.Option[_root_.scala.Predef.String]
  ): _root_.org.yupana.proto.ResultHeader = _root_.org.yupana.proto.ResultHeader(
    fields,
    tableName
  )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy