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

chainrpc.ConfEvent.scala Maven / Gradle / Ivy

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

package chainrpc

@SerialVersionUID(0L)
final case class ConfEvent(
    event: chainrpc.ConfEvent.Event = chainrpc.ConfEvent.Event.Empty,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[ConfEvent] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      if (event.conf.isDefined) {
        val __value = event.conf.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (event.reorg.isDefined) {
        val __value = event.reorg.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      __size += unknownFields.serializedSize
      __size
    }
    override def serializedSize: _root_.scala.Int = {
      var __size = __serializedSizeMemoized
      if (__size == 0) {
        __size = __computeSerializedSize() + 1
        __serializedSizeMemoized = __size
      }
      __size - 1
      
    }
    def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
      event.conf.foreach { __v =>
        val __m = __v
        _output__.writeTag(1, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      event.reorg.foreach { __v =>
        val __m = __v
        _output__.writeTag(2, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      unknownFields.writeTo(_output__)
    }
    def getConf: chainrpc.ConfDetails = event.conf.getOrElse(chainrpc.ConfDetails.defaultInstance)
    def withConf(__v: chainrpc.ConfDetails): ConfEvent = copy(event = chainrpc.ConfEvent.Event.Conf(__v))
    def getReorg: chainrpc.Reorg = event.reorg.getOrElse(chainrpc.Reorg.defaultInstance)
    def withReorg(__v: chainrpc.Reorg): ConfEvent = copy(event = chainrpc.ConfEvent.Event.Reorg(__v))
    def clearEvent: ConfEvent = copy(event = chainrpc.ConfEvent.Event.Empty)
    def withEvent(__v: chainrpc.ConfEvent.Event): ConfEvent = copy(event = __v)
    def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v)
    def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty)
    def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
      (__fieldNumber: @_root_.scala.unchecked) match {
        case 1 => event.conf.orNull
        case 2 => event.reorg.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 => event.conf.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 2 => event.reorg.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: chainrpc.ConfEvent.type = chainrpc.ConfEvent
    // @@protoc_insertion_point(GeneratedMessage[chainrpc.ConfEvent])
}

object ConfEvent extends scalapb.GeneratedMessageCompanion[chainrpc.ConfEvent] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[chainrpc.ConfEvent] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): chainrpc.ConfEvent = {
    var __event: chainrpc.ConfEvent.Event = chainrpc.ConfEvent.Event.Empty
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 10 =>
          __event = chainrpc.ConfEvent.Event.Conf(__event.conf.fold(_root_.scalapb.LiteParser.readMessage[chainrpc.ConfDetails](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 18 =>
          __event = chainrpc.ConfEvent.Event.Reorg(__event.reorg.fold(_root_.scalapb.LiteParser.readMessage[chainrpc.Reorg](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    chainrpc.ConfEvent(
        event = __event,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[chainrpc.ConfEvent] = _root_.scalapb.descriptors.Reads{
    case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
      _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.")
      chainrpc.ConfEvent(
        event = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[chainrpc.ConfDetails]]).map(chainrpc.ConfEvent.Event.Conf(_))
            .orElse[chainrpc.ConfEvent.Event](__fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[chainrpc.Reorg]]).map(chainrpc.ConfEvent.Event.Reorg(_)))
            .getOrElse(chainrpc.ConfEvent.Event.Empty)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ChainnotifierProto.javaDescriptor.getMessageTypes().get(3)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ChainnotifierProto.scalaDescriptor.messages(3)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 1 => __out = chainrpc.ConfDetails
      case 2 => __out = chainrpc.Reorg
    }
    __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 = chainrpc.ConfEvent(
    event = chainrpc.ConfEvent.Event.Empty
  )
  sealed trait Event extends _root_.scalapb.GeneratedOneof {
    def isEmpty: _root_.scala.Boolean = false
    def isDefined: _root_.scala.Boolean = true
    def isConf: _root_.scala.Boolean = false
    def isReorg: _root_.scala.Boolean = false
    def conf: _root_.scala.Option[chainrpc.ConfDetails] = _root_.scala.None
    def reorg: _root_.scala.Option[chainrpc.Reorg] = _root_.scala.None
  }
  object Event {
    @SerialVersionUID(0L)
    case object Empty extends chainrpc.ConfEvent.Event {
      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 Conf(value: chainrpc.ConfDetails) extends chainrpc.ConfEvent.Event {
      type ValueType = chainrpc.ConfDetails
      override def isConf: _root_.scala.Boolean = true
      override def conf: _root_.scala.Option[chainrpc.ConfDetails] = Some(value)
      override def number: _root_.scala.Int = 1
    }
    @SerialVersionUID(0L)
    final case class Reorg(value: chainrpc.Reorg) extends chainrpc.ConfEvent.Event {
      type ValueType = chainrpc.Reorg
      override def isReorg: _root_.scala.Boolean = true
      override def reorg: _root_.scala.Option[chainrpc.Reorg] = Some(value)
      override def number: _root_.scala.Int = 2
    }
  }
  implicit class ConfEventLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, chainrpc.ConfEvent]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, chainrpc.ConfEvent](_l) {
    def conf: _root_.scalapb.lenses.Lens[UpperPB, chainrpc.ConfDetails] = field(_.getConf)((c_, f_) => c_.copy(event = chainrpc.ConfEvent.Event.Conf(f_)))
    def reorg: _root_.scalapb.lenses.Lens[UpperPB, chainrpc.Reorg] = field(_.getReorg)((c_, f_) => c_.copy(event = chainrpc.ConfEvent.Event.Reorg(f_)))
    def event: _root_.scalapb.lenses.Lens[UpperPB, chainrpc.ConfEvent.Event] = field(_.event)((c_, f_) => c_.copy(event = f_))
  }
  final val CONF_FIELD_NUMBER = 1
  final val REORG_FIELD_NUMBER = 2
  def of(
    event: chainrpc.ConfEvent.Event
  ): _root_.chainrpc.ConfEvent = _root_.chainrpc.ConfEvent(
    event
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[chainrpc.ConfEvent])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy