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

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

// 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 Request(
    req: org.yupana.proto.Request.Req = org.yupana.proto.Request.Req.Empty
    ) extends scalapb.GeneratedMessage with scalapb.Message[Request] with scalapb.lenses.Updatable[Request] {
    @transient
    private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0
    private[this] def __computeSerializedValue(): _root_.scala.Int = {
      var __size = 0
      if (req.ping.isDefined) {
        val __value = req.ping.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (req.sqlQuery.isDefined) {
        val __value = req.sqlQuery.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (req.batchSqlQuery.isDefined) {
        val __value = req.batchSqlQuery.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      __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 = {
      req.ping.foreach { __v =>
        val __m = __v
        _output__.writeTag(2, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      req.sqlQuery.foreach { __v =>
        val __m = __v
        _output__.writeTag(3, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      req.batchSqlQuery.foreach { __v =>
        val __m = __v
        _output__.writeTag(4, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
    }
    def mergeFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): org.yupana.proto.Request = {
      var __req = this.req
      var _done__ = false
      while (!_done__) {
        val _tag__ = _input__.readTag()
        _tag__ match {
          case 0 => _done__ = true
          case 18 =>
            __req = org.yupana.proto.Request.Req.Ping(_root_.scalapb.LiteParser.readMessage(_input__, req.ping.getOrElse(org.yupana.proto.Ping.defaultInstance)))
          case 26 =>
            __req = org.yupana.proto.Request.Req.SqlQuery(_root_.scalapb.LiteParser.readMessage(_input__, req.sqlQuery.getOrElse(org.yupana.proto.SqlQuery.defaultInstance)))
          case 34 =>
            __req = org.yupana.proto.Request.Req.BatchSqlQuery(_root_.scalapb.LiteParser.readMessage(_input__, req.batchSqlQuery.getOrElse(org.yupana.proto.BatchSqlQuery.defaultInstance)))
          case tag => _input__.skipField(tag)
        }
      }
      org.yupana.proto.Request(
          req = __req
      )
    }
    def getPing: org.yupana.proto.Ping = req.ping.getOrElse(org.yupana.proto.Ping.defaultInstance)
    def withPing(__v: org.yupana.proto.Ping): Request = copy(req = org.yupana.proto.Request.Req.Ping(__v))
    def getSqlQuery: org.yupana.proto.SqlQuery = req.sqlQuery.getOrElse(org.yupana.proto.SqlQuery.defaultInstance)
    def withSqlQuery(__v: org.yupana.proto.SqlQuery): Request = copy(req = org.yupana.proto.Request.Req.SqlQuery(__v))
    def getBatchSqlQuery: org.yupana.proto.BatchSqlQuery = req.batchSqlQuery.getOrElse(org.yupana.proto.BatchSqlQuery.defaultInstance)
    def withBatchSqlQuery(__v: org.yupana.proto.BatchSqlQuery): Request = copy(req = org.yupana.proto.Request.Req.BatchSqlQuery(__v))
    def clearReq: Request = copy(req = org.yupana.proto.Request.Req.Empty)
    def withReq(__v: org.yupana.proto.Request.Req): Request = copy(req = __v)
    def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
      (__fieldNumber: @_root_.scala.unchecked) match {
        case 2 => req.ping.orNull
        case 3 => req.sqlQuery.orNull
        case 4 => req.batchSqlQuery.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 2 => req.ping.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 3 => req.sqlQuery.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 4 => req.batchSqlQuery.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion = org.yupana.proto.Request
}

object Request extends scalapb.GeneratedMessageCompanion[org.yupana.proto.Request] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[org.yupana.proto.Request] = this
  def fromFieldsMap(__fieldsMap: scala.collection.immutable.Map[_root_.com.google.protobuf.Descriptors.FieldDescriptor, _root_.scala.Any]): org.yupana.proto.Request = {
    _root_.scala.Predef.require(__fieldsMap.keys.forall(_.getContainingType() == javaDescriptor), "FieldDescriptor does not match message type.")
    val __fields = javaDescriptor.getFields
    org.yupana.proto.Request(
      req = __fieldsMap.get(__fields.get(0)).asInstanceOf[_root_.scala.Option[org.yupana.proto.Ping]].map(org.yupana.proto.Request.Req.Ping)
    .orElse[org.yupana.proto.Request.Req](__fieldsMap.get(__fields.get(1)).asInstanceOf[_root_.scala.Option[org.yupana.proto.SqlQuery]].map(org.yupana.proto.Request.Req.SqlQuery))
    .orElse[org.yupana.proto.Request.Req](__fieldsMap.get(__fields.get(2)).asInstanceOf[_root_.scala.Option[org.yupana.proto.BatchSqlQuery]].map(org.yupana.proto.Request.Req.BatchSqlQuery))
    .getOrElse(org.yupana.proto.Request.Req.Empty)
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[org.yupana.proto.Request] = _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.Request(
        req = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[org.yupana.proto.Ping]]).map(org.yupana.proto.Request.Req.Ping)
    .orElse[org.yupana.proto.Request.Req](__fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[org.yupana.proto.SqlQuery]]).map(org.yupana.proto.Request.Req.SqlQuery))
    .orElse[org.yupana.proto.Request.Req](__fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).flatMap(_.as[_root_.scala.Option[org.yupana.proto.BatchSqlQuery]]).map(org.yupana.proto.Request.Req.BatchSqlQuery))
    .getOrElse(org.yupana.proto.Request.Req.Empty)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ProtoProto.javaDescriptor.getMessageTypes.get(0)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ProtoProto.scalaDescriptor.messages(0)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 2 => __out = org.yupana.proto.Ping
      case 3 => __out = org.yupana.proto.SqlQuery
      case 4 => __out = org.yupana.proto.BatchSqlQuery
    }
    __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.Request(
    req = org.yupana.proto.Request.Req.Empty
  )
  sealed trait Req extends _root_.scalapb.GeneratedOneof {
    def isEmpty: _root_.scala.Boolean = false
    def isDefined: _root_.scala.Boolean = true
    def isPing: _root_.scala.Boolean = false
    def isSqlQuery: _root_.scala.Boolean = false
    def isBatchSqlQuery: _root_.scala.Boolean = false
    def ping: _root_.scala.Option[org.yupana.proto.Ping] = _root_.scala.None
    def sqlQuery: _root_.scala.Option[org.yupana.proto.SqlQuery] = _root_.scala.None
    def batchSqlQuery: _root_.scala.Option[org.yupana.proto.BatchSqlQuery] = _root_.scala.None
  }
  object Req extends {
    @SerialVersionUID(0L)
    case object Empty extends org.yupana.proto.Request.Req {
      type ValueType = _root_.scala.Nothing
      override def isEmpty: _root_.scala.Boolean = true
      override def isDefined: _root_.scala.Boolean = false
      override def number: _root_.scala.Int = 0
      override def value: _root_.scala.Nothing = throw new java.util.NoSuchElementException("Empty.value")
    }
  
    @SerialVersionUID(0L)
    final case class Ping(value: org.yupana.proto.Ping) extends org.yupana.proto.Request.Req {
      type ValueType = org.yupana.proto.Ping
      override def isPing: _root_.scala.Boolean = true
      override def ping: _root_.scala.Option[org.yupana.proto.Ping] = Some(value)
      override def number: _root_.scala.Int = 2
    }
    @SerialVersionUID(0L)
    final case class SqlQuery(value: org.yupana.proto.SqlQuery) extends org.yupana.proto.Request.Req {
      type ValueType = org.yupana.proto.SqlQuery
      override def isSqlQuery: _root_.scala.Boolean = true
      override def sqlQuery: _root_.scala.Option[org.yupana.proto.SqlQuery] = Some(value)
      override def number: _root_.scala.Int = 3
    }
    @SerialVersionUID(0L)
    final case class BatchSqlQuery(value: org.yupana.proto.BatchSqlQuery) extends org.yupana.proto.Request.Req {
      type ValueType = org.yupana.proto.BatchSqlQuery
      override def isBatchSqlQuery: _root_.scala.Boolean = true
      override def batchSqlQuery: _root_.scala.Option[org.yupana.proto.BatchSqlQuery] = Some(value)
      override def number: _root_.scala.Int = 4
    }
  }
  implicit class RequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, org.yupana.proto.Request]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, org.yupana.proto.Request](_l) {
    def ping: _root_.scalapb.lenses.Lens[UpperPB, org.yupana.proto.Ping] = field(_.getPing)((c_, f_) => c_.copy(req = org.yupana.proto.Request.Req.Ping(f_)))
    def sqlQuery: _root_.scalapb.lenses.Lens[UpperPB, org.yupana.proto.SqlQuery] = field(_.getSqlQuery)((c_, f_) => c_.copy(req = org.yupana.proto.Request.Req.SqlQuery(f_)))
    def batchSqlQuery: _root_.scalapb.lenses.Lens[UpperPB, org.yupana.proto.BatchSqlQuery] = field(_.getBatchSqlQuery)((c_, f_) => c_.copy(req = org.yupana.proto.Request.Req.BatchSqlQuery(f_)))
    def req: _root_.scalapb.lenses.Lens[UpperPB, org.yupana.proto.Request.Req] = field(_.req)((c_, f_) => c_.copy(req = f_))
  }
  final val PING_FIELD_NUMBER = 2
  final val SQLQUERY_FIELD_NUMBER = 3
  final val BATCHSQLQUERY_FIELD_NUMBER = 4
  def of(
    req: org.yupana.proto.Request.Req
  ): _root_.org.yupana.proto.Request = _root_.org.yupana.proto.Request(
    req
  )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy