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

peersrpc.NodeAnnouncementUpdateRequest.scala Maven / Gradle / Ivy

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

package peersrpc

/** @param featureUpdates
  *   Set of changes for the features that the node supports.
  * @param color
  *   Color is the node's color in hex code format.
  * @param alias
  *   Alias or nick name of the node.
  * @param addressUpdates
  *   Set of changes for the node's known addresses.
  */
@SerialVersionUID(0L)
final case class NodeAnnouncementUpdateRequest(
    featureUpdates: _root_.scala.Seq[peersrpc.UpdateFeatureAction] = _root_.scala.Seq.empty,
    color: _root_.scala.Predef.String = "",
    alias: _root_.scala.Predef.String = "",
    addressUpdates: _root_.scala.Seq[peersrpc.UpdateAddressAction] = _root_.scala.Seq.empty,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[NodeAnnouncementUpdateRequest] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      featureUpdates.foreach { __item =>
        val __value = __item
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      }
      
      {
        val __value = color
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value)
        }
      };
      
      {
        val __value = alias
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __value)
        }
      };
      addressUpdates.foreach { __item =>
        val __value = __item
        __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 = {
      featureUpdates.foreach { __v =>
        val __m = __v
        _output__.writeTag(1, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      {
        val __v = color
        if (!__v.isEmpty) {
          _output__.writeString(2, __v)
        }
      };
      {
        val __v = alias
        if (!__v.isEmpty) {
          _output__.writeString(3, __v)
        }
      };
      addressUpdates.foreach { __v =>
        val __m = __v
        _output__.writeTag(4, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      unknownFields.writeTo(_output__)
    }
    def clearFeatureUpdates = copy(featureUpdates = _root_.scala.Seq.empty)
    def addFeatureUpdates(__vs: peersrpc.UpdateFeatureAction *): NodeAnnouncementUpdateRequest = addAllFeatureUpdates(__vs)
    def addAllFeatureUpdates(__vs: Iterable[peersrpc.UpdateFeatureAction]): NodeAnnouncementUpdateRequest = copy(featureUpdates = featureUpdates ++ __vs)
    def withFeatureUpdates(__v: _root_.scala.Seq[peersrpc.UpdateFeatureAction]): NodeAnnouncementUpdateRequest = copy(featureUpdates = __v)
    def withColor(__v: _root_.scala.Predef.String): NodeAnnouncementUpdateRequest = copy(color = __v)
    def withAlias(__v: _root_.scala.Predef.String): NodeAnnouncementUpdateRequest = copy(alias = __v)
    def clearAddressUpdates = copy(addressUpdates = _root_.scala.Seq.empty)
    def addAddressUpdates(__vs: peersrpc.UpdateAddressAction *): NodeAnnouncementUpdateRequest = addAllAddressUpdates(__vs)
    def addAllAddressUpdates(__vs: Iterable[peersrpc.UpdateAddressAction]): NodeAnnouncementUpdateRequest = copy(addressUpdates = addressUpdates ++ __vs)
    def withAddressUpdates(__v: _root_.scala.Seq[peersrpc.UpdateAddressAction]): NodeAnnouncementUpdateRequest = copy(addressUpdates = __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 => featureUpdates
        case 2 => {
          val __t = color
          if (__t != "") __t else null
        }
        case 3 => {
          val __t = alias
          if (__t != "") __t else null
        }
        case 4 => addressUpdates
      }
    }
    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(featureUpdates.iterator.map(_.toPMessage).toVector)
        case 2 => _root_.scalapb.descriptors.PString(color)
        case 3 => _root_.scalapb.descriptors.PString(alias)
        case 4 => _root_.scalapb.descriptors.PRepeated(addressUpdates.iterator.map(_.toPMessage).toVector)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: peersrpc.NodeAnnouncementUpdateRequest.type = peersrpc.NodeAnnouncementUpdateRequest
    // @@protoc_insertion_point(GeneratedMessage[peersrpc.NodeAnnouncementUpdateRequest])
}

object NodeAnnouncementUpdateRequest extends scalapb.GeneratedMessageCompanion[peersrpc.NodeAnnouncementUpdateRequest] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[peersrpc.NodeAnnouncementUpdateRequest] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): peersrpc.NodeAnnouncementUpdateRequest = {
    val __featureUpdates: _root_.scala.collection.immutable.VectorBuilder[peersrpc.UpdateFeatureAction] = new _root_.scala.collection.immutable.VectorBuilder[peersrpc.UpdateFeatureAction]
    var __color: _root_.scala.Predef.String = ""
    var __alias: _root_.scala.Predef.String = ""
    val __addressUpdates: _root_.scala.collection.immutable.VectorBuilder[peersrpc.UpdateAddressAction] = new _root_.scala.collection.immutable.VectorBuilder[peersrpc.UpdateAddressAction]
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 10 =>
          __featureUpdates += _root_.scalapb.LiteParser.readMessage[peersrpc.UpdateFeatureAction](_input__)
        case 18 =>
          __color = _input__.readStringRequireUtf8()
        case 26 =>
          __alias = _input__.readStringRequireUtf8()
        case 34 =>
          __addressUpdates += _root_.scalapb.LiteParser.readMessage[peersrpc.UpdateAddressAction](_input__)
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    peersrpc.NodeAnnouncementUpdateRequest(
        featureUpdates = __featureUpdates.result(),
        color = __color,
        alias = __alias,
        addressUpdates = __addressUpdates.result(),
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[peersrpc.NodeAnnouncementUpdateRequest] = _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.")
      peersrpc.NodeAnnouncementUpdateRequest(
        featureUpdates = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Seq[peersrpc.UpdateFeatureAction]]).getOrElse(_root_.scala.Seq.empty),
        color = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        alias = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        addressUpdates = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Seq[peersrpc.UpdateAddressAction]]).getOrElse(_root_.scala.Seq.empty)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = PeersProto.javaDescriptor.getMessageTypes().get(2)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = PeersProto.scalaDescriptor.messages(2)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 1 => __out = peersrpc.UpdateFeatureAction
      case 4 => __out = peersrpc.UpdateAddressAction
    }
    __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 = peersrpc.NodeAnnouncementUpdateRequest(
    featureUpdates = _root_.scala.Seq.empty,
    color = "",
    alias = "",
    addressUpdates = _root_.scala.Seq.empty
  )
  implicit class NodeAnnouncementUpdateRequestLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, peersrpc.NodeAnnouncementUpdateRequest]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, peersrpc.NodeAnnouncementUpdateRequest](_l) {
    def featureUpdates: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[peersrpc.UpdateFeatureAction]] = field(_.featureUpdates)((c_, f_) => c_.copy(featureUpdates = f_))
    def color: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.color)((c_, f_) => c_.copy(color = f_))
    def alias: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.alias)((c_, f_) => c_.copy(alias = f_))
    def addressUpdates: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[peersrpc.UpdateAddressAction]] = field(_.addressUpdates)((c_, f_) => c_.copy(addressUpdates = f_))
  }
  final val FEATURE_UPDATES_FIELD_NUMBER = 1
  final val COLOR_FIELD_NUMBER = 2
  final val ALIAS_FIELD_NUMBER = 3
  final val ADDRESS_UPDATES_FIELD_NUMBER = 4
  def of(
    featureUpdates: _root_.scala.Seq[peersrpc.UpdateFeatureAction],
    color: _root_.scala.Predef.String,
    alias: _root_.scala.Predef.String,
    addressUpdates: _root_.scala.Seq[peersrpc.UpdateAddressAction]
  ): _root_.peersrpc.NodeAnnouncementUpdateRequest = _root_.peersrpc.NodeAnnouncementUpdateRequest(
    featureUpdates,
    color,
    alias,
    addressUpdates
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[peersrpc.NodeAnnouncementUpdateRequest])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy