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

org.yupana.proto.Response.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 Response(
    resp: org.yupana.proto.Response.Resp = org.yupana.proto.Response.Resp.Empty
    ) extends scalapb.GeneratedMessage with scalapb.Message[Response] with scalapb.lenses.Updatable[Response] {
    @transient
    private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0
    private[this] def __computeSerializedValue(): _root_.scala.Int = {
      var __size = 0
      if (resp.resultHeader.isDefined) {
        val __value = resp.resultHeader.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (resp.result.isDefined) {
        val __value = resp.result.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (resp.heartbeat.isDefined) {
        val __value = resp.heartbeat.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __value)
      };
      if (resp.error.isDefined) {
        val __value = resp.error.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(4, __value)
      };
      if (resp.pong.isDefined) {
        val __value = resp.pong.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (resp.resultStatistics.isDefined) {
        val __value = resp.resultStatistics.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 = {
      resp.resultHeader.foreach { __v =>
        val __m = __v
        _output__.writeTag(1, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      resp.result.foreach { __v =>
        val __m = __v
        _output__.writeTag(2, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      resp.heartbeat.foreach { __v =>
        val __m = __v
        _output__.writeString(3, __m)
      };
      resp.error.foreach { __v =>
        val __m = __v
        _output__.writeString(4, __m)
      };
      resp.pong.foreach { __v =>
        val __m = __v
        _output__.writeTag(5, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      resp.resultStatistics.foreach { __v =>
        val __m = __v
        _output__.writeTag(6, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
    }
    def mergeFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): org.yupana.proto.Response = {
      var __resp = this.resp
      var _done__ = false
      while (!_done__) {
        val _tag__ = _input__.readTag()
        _tag__ match {
          case 0 => _done__ = true
          case 10 =>
            __resp = org.yupana.proto.Response.Resp.ResultHeader(_root_.scalapb.LiteParser.readMessage(_input__, resp.resultHeader.getOrElse(org.yupana.proto.ResultHeader.defaultInstance)))
          case 18 =>
            __resp = org.yupana.proto.Response.Resp.Result(_root_.scalapb.LiteParser.readMessage(_input__, resp.result.getOrElse(org.yupana.proto.ResultChunk.defaultInstance)))
          case 26 =>
            __resp = org.yupana.proto.Response.Resp.Heartbeat(_input__.readString())
          case 34 =>
            __resp = org.yupana.proto.Response.Resp.Error(_input__.readString())
          case 42 =>
            __resp = org.yupana.proto.Response.Resp.Pong(_root_.scalapb.LiteParser.readMessage(_input__, resp.pong.getOrElse(org.yupana.proto.Pong.defaultInstance)))
          case 50 =>
            __resp = org.yupana.proto.Response.Resp.ResultStatistics(_root_.scalapb.LiteParser.readMessage(_input__, resp.resultStatistics.getOrElse(org.yupana.proto.ResultStatistics.defaultInstance)))
          case tag => _input__.skipField(tag)
        }
      }
      org.yupana.proto.Response(
          resp = __resp
      )
    }
    def getResultHeader: org.yupana.proto.ResultHeader = resp.resultHeader.getOrElse(org.yupana.proto.ResultHeader.defaultInstance)
    def withResultHeader(__v: org.yupana.proto.ResultHeader): Response = copy(resp = org.yupana.proto.Response.Resp.ResultHeader(__v))
    def getResult: org.yupana.proto.ResultChunk = resp.result.getOrElse(org.yupana.proto.ResultChunk.defaultInstance)
    def withResult(__v: org.yupana.proto.ResultChunk): Response = copy(resp = org.yupana.proto.Response.Resp.Result(__v))
    def getHeartbeat: _root_.scala.Predef.String = resp.heartbeat.getOrElse("")
    def withHeartbeat(__v: _root_.scala.Predef.String): Response = copy(resp = org.yupana.proto.Response.Resp.Heartbeat(__v))
    def getError: _root_.scala.Predef.String = resp.error.getOrElse("")
    def withError(__v: _root_.scala.Predef.String): Response = copy(resp = org.yupana.proto.Response.Resp.Error(__v))
    def getPong: org.yupana.proto.Pong = resp.pong.getOrElse(org.yupana.proto.Pong.defaultInstance)
    def withPong(__v: org.yupana.proto.Pong): Response = copy(resp = org.yupana.proto.Response.Resp.Pong(__v))
    def getResultStatistics: org.yupana.proto.ResultStatistics = resp.resultStatistics.getOrElse(org.yupana.proto.ResultStatistics.defaultInstance)
    def withResultStatistics(__v: org.yupana.proto.ResultStatistics): Response = copy(resp = org.yupana.proto.Response.Resp.ResultStatistics(__v))
    def clearResp: Response = copy(resp = org.yupana.proto.Response.Resp.Empty)
    def withResp(__v: org.yupana.proto.Response.Resp): Response = copy(resp = __v)
    def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
      (__fieldNumber: @_root_.scala.unchecked) match {
        case 1 => resp.resultHeader.orNull
        case 2 => resp.result.orNull
        case 3 => resp.heartbeat.orNull
        case 4 => resp.error.orNull
        case 5 => resp.pong.orNull
        case 6 => resp.resultStatistics.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 => resp.resultHeader.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 2 => resp.result.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 3 => resp.heartbeat.map(_root_.scalapb.descriptors.PString).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 4 => resp.error.map(_root_.scalapb.descriptors.PString).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 5 => resp.pong.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 6 => resp.resultStatistics.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion = org.yupana.proto.Response
}

object Response extends scalapb.GeneratedMessageCompanion[org.yupana.proto.Response] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[org.yupana.proto.Response] = this
  def fromFieldsMap(__fieldsMap: scala.collection.immutable.Map[_root_.com.google.protobuf.Descriptors.FieldDescriptor, _root_.scala.Any]): org.yupana.proto.Response = {
    _root_.scala.Predef.require(__fieldsMap.keys.forall(_.getContainingType() == javaDescriptor), "FieldDescriptor does not match message type.")
    val __fields = javaDescriptor.getFields
    org.yupana.proto.Response(
      resp = __fieldsMap.get(__fields.get(0)).asInstanceOf[_root_.scala.Option[org.yupana.proto.ResultHeader]].map(org.yupana.proto.Response.Resp.ResultHeader)
    .orElse[org.yupana.proto.Response.Resp](__fieldsMap.get(__fields.get(1)).asInstanceOf[_root_.scala.Option[org.yupana.proto.ResultChunk]].map(org.yupana.proto.Response.Resp.Result))
    .orElse[org.yupana.proto.Response.Resp](__fieldsMap.get(__fields.get(2)).asInstanceOf[_root_.scala.Option[_root_.scala.Predef.String]].map(org.yupana.proto.Response.Resp.Heartbeat))
    .orElse[org.yupana.proto.Response.Resp](__fieldsMap.get(__fields.get(3)).asInstanceOf[_root_.scala.Option[_root_.scala.Predef.String]].map(org.yupana.proto.Response.Resp.Error))
    .orElse[org.yupana.proto.Response.Resp](__fieldsMap.get(__fields.get(4)).asInstanceOf[_root_.scala.Option[org.yupana.proto.Pong]].map(org.yupana.proto.Response.Resp.Pong))
    .orElse[org.yupana.proto.Response.Resp](__fieldsMap.get(__fields.get(5)).asInstanceOf[_root_.scala.Option[org.yupana.proto.ResultStatistics]].map(org.yupana.proto.Response.Resp.ResultStatistics))
    .getOrElse(org.yupana.proto.Response.Resp.Empty)
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[org.yupana.proto.Response] = _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.Response(
        resp = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[org.yupana.proto.ResultHeader]]).map(org.yupana.proto.Response.Resp.ResultHeader)
    .orElse[org.yupana.proto.Response.Resp](__fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[org.yupana.proto.ResultChunk]]).map(org.yupana.proto.Response.Resp.Result))
    .orElse[org.yupana.proto.Response.Resp](__fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Predef.String]]).map(org.yupana.proto.Response.Resp.Heartbeat))
    .orElse[org.yupana.proto.Response.Resp](__fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Predef.String]]).map(org.yupana.proto.Response.Resp.Error))
    .orElse[org.yupana.proto.Response.Resp](__fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).flatMap(_.as[_root_.scala.Option[org.yupana.proto.Pong]]).map(org.yupana.proto.Response.Resp.Pong))
    .orElse[org.yupana.proto.Response.Resp](__fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).flatMap(_.as[_root_.scala.Option[org.yupana.proto.ResultStatistics]]).map(org.yupana.proto.Response.Resp.ResultStatistics))
    .getOrElse(org.yupana.proto.Response.Resp.Empty)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ProtoProto.javaDescriptor.getMessageTypes.get(12)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ProtoProto.scalaDescriptor.messages(12)
  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.ResultHeader
      case 2 => __out = org.yupana.proto.ResultChunk
      case 5 => __out = org.yupana.proto.Pong
      case 6 => __out = org.yupana.proto.ResultStatistics
    }
    __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.Response(
    resp = org.yupana.proto.Response.Resp.Empty
  )
  sealed trait Resp extends _root_.scalapb.GeneratedOneof {
    def isEmpty: _root_.scala.Boolean = false
    def isDefined: _root_.scala.Boolean = true
    def isResultHeader: _root_.scala.Boolean = false
    def isResult: _root_.scala.Boolean = false
    def isHeartbeat: _root_.scala.Boolean = false
    def isError: _root_.scala.Boolean = false
    def isPong: _root_.scala.Boolean = false
    def isResultStatistics: _root_.scala.Boolean = false
    def resultHeader: _root_.scala.Option[org.yupana.proto.ResultHeader] = _root_.scala.None
    def result: _root_.scala.Option[org.yupana.proto.ResultChunk] = _root_.scala.None
    def heartbeat: _root_.scala.Option[_root_.scala.Predef.String] = _root_.scala.None
    def error: _root_.scala.Option[_root_.scala.Predef.String] = _root_.scala.None
    def pong: _root_.scala.Option[org.yupana.proto.Pong] = _root_.scala.None
    def resultStatistics: _root_.scala.Option[org.yupana.proto.ResultStatistics] = _root_.scala.None
  }
  object Resp extends {
    @SerialVersionUID(0L)
    case object Empty extends org.yupana.proto.Response.Resp {
      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 ResultHeader(value: org.yupana.proto.ResultHeader) extends org.yupana.proto.Response.Resp {
      type ValueType = org.yupana.proto.ResultHeader
      override def isResultHeader: _root_.scala.Boolean = true
      override def resultHeader: _root_.scala.Option[org.yupana.proto.ResultHeader] = Some(value)
      override def number: _root_.scala.Int = 1
    }
    @SerialVersionUID(0L)
    final case class Result(value: org.yupana.proto.ResultChunk) extends org.yupana.proto.Response.Resp {
      type ValueType = org.yupana.proto.ResultChunk
      override def isResult: _root_.scala.Boolean = true
      override def result: _root_.scala.Option[org.yupana.proto.ResultChunk] = Some(value)
      override def number: _root_.scala.Int = 2
    }
    @SerialVersionUID(0L)
    final case class Heartbeat(value: _root_.scala.Predef.String) extends org.yupana.proto.Response.Resp {
      type ValueType = _root_.scala.Predef.String
      override def isHeartbeat: _root_.scala.Boolean = true
      override def heartbeat: _root_.scala.Option[_root_.scala.Predef.String] = Some(value)
      override def number: _root_.scala.Int = 3
    }
    @SerialVersionUID(0L)
    final case class Error(value: _root_.scala.Predef.String) extends org.yupana.proto.Response.Resp {
      type ValueType = _root_.scala.Predef.String
      override def isError: _root_.scala.Boolean = true
      override def error: _root_.scala.Option[_root_.scala.Predef.String] = Some(value)
      override def number: _root_.scala.Int = 4
    }
    @SerialVersionUID(0L)
    final case class Pong(value: org.yupana.proto.Pong) extends org.yupana.proto.Response.Resp {
      type ValueType = org.yupana.proto.Pong
      override def isPong: _root_.scala.Boolean = true
      override def pong: _root_.scala.Option[org.yupana.proto.Pong] = Some(value)
      override def number: _root_.scala.Int = 5
    }
    @SerialVersionUID(0L)
    final case class ResultStatistics(value: org.yupana.proto.ResultStatistics) extends org.yupana.proto.Response.Resp {
      type ValueType = org.yupana.proto.ResultStatistics
      override def isResultStatistics: _root_.scala.Boolean = true
      override def resultStatistics: _root_.scala.Option[org.yupana.proto.ResultStatistics] = Some(value)
      override def number: _root_.scala.Int = 6
    }
  }
  implicit class ResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, org.yupana.proto.Response]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, org.yupana.proto.Response](_l) {
    def resultHeader: _root_.scalapb.lenses.Lens[UpperPB, org.yupana.proto.ResultHeader] = field(_.getResultHeader)((c_, f_) => c_.copy(resp = org.yupana.proto.Response.Resp.ResultHeader(f_)))
    def result: _root_.scalapb.lenses.Lens[UpperPB, org.yupana.proto.ResultChunk] = field(_.getResult)((c_, f_) => c_.copy(resp = org.yupana.proto.Response.Resp.Result(f_)))
    def heartbeat: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.getHeartbeat)((c_, f_) => c_.copy(resp = org.yupana.proto.Response.Resp.Heartbeat(f_)))
    def error: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.getError)((c_, f_) => c_.copy(resp = org.yupana.proto.Response.Resp.Error(f_)))
    def pong: _root_.scalapb.lenses.Lens[UpperPB, org.yupana.proto.Pong] = field(_.getPong)((c_, f_) => c_.copy(resp = org.yupana.proto.Response.Resp.Pong(f_)))
    def resultStatistics: _root_.scalapb.lenses.Lens[UpperPB, org.yupana.proto.ResultStatistics] = field(_.getResultStatistics)((c_, f_) => c_.copy(resp = org.yupana.proto.Response.Resp.ResultStatistics(f_)))
    def resp: _root_.scalapb.lenses.Lens[UpperPB, org.yupana.proto.Response.Resp] = field(_.resp)((c_, f_) => c_.copy(resp = f_))
  }
  final val RESULTHEADER_FIELD_NUMBER = 1
  final val RESULT_FIELD_NUMBER = 2
  final val HEARTBEAT_FIELD_NUMBER = 3
  final val ERROR_FIELD_NUMBER = 4
  final val PONG_FIELD_NUMBER = 5
  final val RESULTSTATISTICS_FIELD_NUMBER = 6
  def of(
    resp: org.yupana.proto.Response.Resp
  ): _root_.org.yupana.proto.Response = _root_.org.yupana.proto.Response(
    resp
  )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy