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

chainrpc.SpendEvent.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 SpendEvent(
    event: chainrpc.SpendEvent.Event = chainrpc.SpendEvent.Event.Empty,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[SpendEvent] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      if (event.spend.isDefined) {
        val __value = event.spend.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.spend.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 getSpend: chainrpc.SpendDetails = event.spend.getOrElse(chainrpc.SpendDetails.defaultInstance)
    def withSpend(__v: chainrpc.SpendDetails): SpendEvent = copy(event = chainrpc.SpendEvent.Event.Spend(__v))
    def getReorg: chainrpc.Reorg = event.reorg.getOrElse(chainrpc.Reorg.defaultInstance)
    def withReorg(__v: chainrpc.Reorg): SpendEvent = copy(event = chainrpc.SpendEvent.Event.Reorg(__v))
    def clearEvent: SpendEvent = copy(event = chainrpc.SpendEvent.Event.Empty)
    def withEvent(__v: chainrpc.SpendEvent.Event): SpendEvent = 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.spend.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.spend.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.SpendEvent.type = chainrpc.SpendEvent
    // @@protoc_insertion_point(GeneratedMessage[chainrpc.SpendEvent])
}

object SpendEvent extends scalapb.GeneratedMessageCompanion[chainrpc.SpendEvent] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[chainrpc.SpendEvent] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): chainrpc.SpendEvent = {
    var __event: chainrpc.SpendEvent.Event = chainrpc.SpendEvent.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.SpendEvent.Event.Spend(__event.spend.fold(_root_.scalapb.LiteParser.readMessage[chainrpc.SpendDetails](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 18 =>
          __event = chainrpc.SpendEvent.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.SpendEvent(
        event = __event,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[chainrpc.SpendEvent] = _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.SpendEvent(
        event = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[chainrpc.SpendDetails]]).map(chainrpc.SpendEvent.Event.Spend(_))
            .orElse[chainrpc.SpendEvent.Event](__fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[chainrpc.Reorg]]).map(chainrpc.SpendEvent.Event.Reorg(_)))
            .getOrElse(chainrpc.SpendEvent.Event.Empty)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ChainnotifierProto.javaDescriptor.getMessageTypes().get(7)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ChainnotifierProto.scalaDescriptor.messages(7)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 1 => __out = chainrpc.SpendDetails
      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.SpendEvent(
    event = chainrpc.SpendEvent.Event.Empty
  )
  sealed trait Event extends _root_.scalapb.GeneratedOneof {
    def isEmpty: _root_.scala.Boolean = false
    def isDefined: _root_.scala.Boolean = true
    def isSpend: _root_.scala.Boolean = false
    def isReorg: _root_.scala.Boolean = false
    def spend: _root_.scala.Option[chainrpc.SpendDetails] = _root_.scala.None
    def reorg: _root_.scala.Option[chainrpc.Reorg] = _root_.scala.None
  }
  object Event {
    @SerialVersionUID(0L)
    case object Empty extends chainrpc.SpendEvent.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 Spend(value: chainrpc.SpendDetails) extends chainrpc.SpendEvent.Event {
      type ValueType = chainrpc.SpendDetails
      override def isSpend: _root_.scala.Boolean = true
      override def spend: _root_.scala.Option[chainrpc.SpendDetails] = Some(value)
      override def number: _root_.scala.Int = 1
    }
    @SerialVersionUID(0L)
    final case class Reorg(value: chainrpc.Reorg) extends chainrpc.SpendEvent.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 SpendEventLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, chainrpc.SpendEvent]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, chainrpc.SpendEvent](_l) {
    def spend: _root_.scalapb.lenses.Lens[UpperPB, chainrpc.SpendDetails] = field(_.getSpend)((c_, f_) => c_.copy(event = chainrpc.SpendEvent.Event.Spend(f_)))
    def reorg: _root_.scalapb.lenses.Lens[UpperPB, chainrpc.Reorg] = field(_.getReorg)((c_, f_) => c_.copy(event = chainrpc.SpendEvent.Event.Reorg(f_)))
    def event: _root_.scalapb.lenses.Lens[UpperPB, chainrpc.SpendEvent.Event] = field(_.event)((c_, f_) => c_.copy(event = f_))
  }
  final val SPEND_FIELD_NUMBER = 1
  final val REORG_FIELD_NUMBER = 2
  def of(
    event: chainrpc.SpendEvent.Event
  ): _root_.chainrpc.SpendEvent = _root_.chainrpc.SpendEvent(
    event
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[chainrpc.SpendEvent])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy