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

beaker.server.protobuf.Revisions.scala Maven / Gradle / Ivy

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

package beaker.server.protobuf

/** *
  * A collection of revisions.
  *
  * @param entries Revisions of keys.
  */
@SerialVersionUID(0L)
final case class Revisions(
    entries: scala.collection.immutable.Map[_root_.scala.Predef.String, beaker.server.protobuf.Revision] = scala.collection.immutable.Map.empty
    ) extends scalapb.GeneratedMessage with scalapb.Message[Revisions] with scalapb.lenses.Updatable[Revisions] {
    @transient
    private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0
    private[this] def __computeSerializedValue(): _root_.scala.Int = {
      var __size = 0
      entries.foreach(entries => __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(beaker.server.protobuf.Revisions._typemapper_entries.toBase(entries).serializedSize) + beaker.server.protobuf.Revisions._typemapper_entries.toBase(entries).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 = {
      entries.foreach { __v =>
        _output__.writeTag(1, 2)
        _output__.writeUInt32NoTag(beaker.server.protobuf.Revisions._typemapper_entries.toBase(__v).serializedSize)
        beaker.server.protobuf.Revisions._typemapper_entries.toBase(__v).writeTo(_output__)
      };
    }
    def mergeFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): beaker.server.protobuf.Revisions = {
      val __entries = (scala.collection.immutable.Map.newBuilder[_root_.scala.Predef.String, beaker.server.protobuf.Revision] ++= this.entries)
      var _done__ = false
      while (!_done__) {
        val _tag__ = _input__.readTag()
        _tag__ match {
          case 0 => _done__ = true
          case 10 =>
            __entries += beaker.server.protobuf.Revisions._typemapper_entries.toCustom(_root_.scalapb.LiteParser.readMessage(_input__, beaker.server.protobuf.Revisions.EntriesEntry.defaultInstance))
          case tag => _input__.skipField(tag)
        }
      }
      beaker.server.protobuf.Revisions(
          entries = __entries.result()
      )
    }
    def clearEntries = copy(entries = scala.collection.immutable.Map.empty)
    def addEntries(__vs: (_root_.scala.Predef.String, beaker.server.protobuf.Revision)*): Revisions = addAllEntries(__vs)
    def addAllEntries(__vs: TraversableOnce[(_root_.scala.Predef.String, beaker.server.protobuf.Revision)]): Revisions = copy(entries = entries ++ __vs)
    def withEntries(__v: scala.collection.immutable.Map[_root_.scala.Predef.String, beaker.server.protobuf.Revision]): Revisions = copy(entries = __v)
    def getFieldByNumber(__fieldNumber: _root_.scala.Int): scala.Any = {
      (__fieldNumber: @_root_.scala.unchecked) match {
        case 1 => entries.map(beaker.server.protobuf.Revisions._typemapper_entries.toBase)(_root_.scala.collection.breakOut)
      }
    }
    def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = {
      require(__field.containingMessage eq companion.scalaDescriptor)
      (__field.number: @_root_.scala.unchecked) match {
        case 1 => _root_.scalapb.descriptors.PRepeated(entries.map(beaker.server.protobuf.Revisions._typemapper_entries.toBase(_).toPMessage)(_root_.scala.collection.breakOut))
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion = beaker.server.protobuf.Revisions
}

object Revisions extends scalapb.GeneratedMessageCompanion[beaker.server.protobuf.Revisions] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[beaker.server.protobuf.Revisions] = this
  def fromFieldsMap(__fieldsMap: scala.collection.immutable.Map[_root_.com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): beaker.server.protobuf.Revisions = {
    require(__fieldsMap.keys.forall(_.getContainingType() == javaDescriptor), "FieldDescriptor does not match message type.")
    val __fields = javaDescriptor.getFields
    beaker.server.protobuf.Revisions(
      __fieldsMap.getOrElse(__fields.get(0), Nil).asInstanceOf[_root_.scala.collection.Seq[beaker.server.protobuf.Revisions.EntriesEntry]].map(beaker.server.protobuf.Revisions._typemapper_entries.toCustom)(_root_.scala.collection.breakOut)
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[beaker.server.protobuf.Revisions] = _root_.scalapb.descriptors.Reads{
    case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
      require(__fieldsMap.keys.forall(_.containingMessage == scalaDescriptor), "FieldDescriptor does not match message type.")
      beaker.server.protobuf.Revisions(
        __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.collection.Seq[beaker.server.protobuf.Revisions.EntriesEntry]]).getOrElse(_root_.scala.collection.Seq.empty).map(beaker.server.protobuf.Revisions._typemapper_entries.toCustom)(_root_.scala.collection.breakOut)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = BeakerProto.javaDescriptor.getMessageTypes.get(5)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = BeakerProto.scalaDescriptor.messages(5)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 1 => __out = beaker.server.protobuf.Revisions.EntriesEntry
    }
    __out
  }
  lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_]] = Seq[_root_.scalapb.GeneratedMessageCompanion[_]](
    _root_.beaker.server.protobuf.Revisions.EntriesEntry
  )
  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
  lazy val defaultInstance = beaker.server.protobuf.Revisions(
  )
  @SerialVersionUID(0L)
  final case class EntriesEntry(
      key: scala.Option[_root_.scala.Predef.String] = None,
      value: scala.Option[beaker.server.protobuf.Revision] = None
      ) extends scalapb.GeneratedMessage with scalapb.Message[EntriesEntry] with scalapb.lenses.Updatable[EntriesEntry] {
      @transient
      private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0
      private[this] def __computeSerializedValue(): _root_.scala.Int = {
        var __size = 0
        if (key.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, key.get) }
        if (value.isDefined) { __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(value.get.serializedSize) + value.get.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 = {
        key.foreach { __v =>
          _output__.writeString(1, __v)
        };
        value.foreach { __v =>
          _output__.writeTag(2, 2)
          _output__.writeUInt32NoTag(__v.serializedSize)
          __v.writeTo(_output__)
        };
      }
      def mergeFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): beaker.server.protobuf.Revisions.EntriesEntry = {
        var __key = this.key
        var __value = this.value
        var _done__ = false
        while (!_done__) {
          val _tag__ = _input__.readTag()
          _tag__ match {
            case 0 => _done__ = true
            case 10 =>
              __key = Option(_input__.readString())
            case 18 =>
              __value = Option(_root_.scalapb.LiteParser.readMessage(_input__, __value.getOrElse(beaker.server.protobuf.Revision.defaultInstance)))
            case tag => _input__.skipField(tag)
          }
        }
        beaker.server.protobuf.Revisions.EntriesEntry(
            key = __key,
            value = __value
        )
      }
      def getKey: _root_.scala.Predef.String = key.getOrElse("")
      def clearKey: EntriesEntry = copy(key = None)
      def withKey(__v: _root_.scala.Predef.String): EntriesEntry = copy(key = Option(__v))
      def getValue: beaker.server.protobuf.Revision = value.getOrElse(beaker.server.protobuf.Revision.defaultInstance)
      def clearValue: EntriesEntry = copy(value = None)
      def withValue(__v: beaker.server.protobuf.Revision): EntriesEntry = copy(value = Option(__v))
      def getFieldByNumber(__fieldNumber: _root_.scala.Int): scala.Any = {
        (__fieldNumber: @_root_.scala.unchecked) match {
          case 1 => key.orNull
          case 2 => value.orNull
        }
      }
      def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = {
        require(__field.containingMessage eq companion.scalaDescriptor)
        (__field.number: @_root_.scala.unchecked) match {
          case 1 => key.map(_root_.scalapb.descriptors.PString).getOrElse(_root_.scalapb.descriptors.PEmpty)
          case 2 => value.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        }
      }
      def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
      def companion = beaker.server.protobuf.Revisions.EntriesEntry
  }
  
  object EntriesEntry extends scalapb.GeneratedMessageCompanion[beaker.server.protobuf.Revisions.EntriesEntry] {
    implicit def messageCompanion: scalapb.GeneratedMessageCompanion[beaker.server.protobuf.Revisions.EntriesEntry] = this
    def fromFieldsMap(__fieldsMap: scala.collection.immutable.Map[_root_.com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): beaker.server.protobuf.Revisions.EntriesEntry = {
      require(__fieldsMap.keys.forall(_.getContainingType() == javaDescriptor), "FieldDescriptor does not match message type.")
      val __fields = javaDescriptor.getFields
      beaker.server.protobuf.Revisions.EntriesEntry(
        __fieldsMap.get(__fields.get(0)).asInstanceOf[scala.Option[_root_.scala.Predef.String]],
        __fieldsMap.get(__fields.get(1)).asInstanceOf[scala.Option[beaker.server.protobuf.Revision]]
      )
    }
    implicit def messageReads: _root_.scalapb.descriptors.Reads[beaker.server.protobuf.Revisions.EntriesEntry] = _root_.scalapb.descriptors.Reads{
      case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
        require(__fieldsMap.keys.forall(_.containingMessage == scalaDescriptor), "FieldDescriptor does not match message type.")
        beaker.server.protobuf.Revisions.EntriesEntry(
          __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[scala.Option[_root_.scala.Predef.String]]),
          __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[scala.Option[beaker.server.protobuf.Revision]])
        )
      case _ => throw new RuntimeException("Expected PMessage")
    }
    def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = beaker.server.protobuf.Revisions.javaDescriptor.getNestedTypes.get(0)
    def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = beaker.server.protobuf.Revisions.scalaDescriptor.nestedMessages(0)
    def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
      var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
      (__number: @_root_.scala.unchecked) match {
        case 2 => __out = beaker.server.protobuf.Revision
      }
      __out
    }
    lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_]] = Seq.empty
    def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
    lazy val defaultInstance = beaker.server.protobuf.Revisions.EntriesEntry(
    )
    implicit class EntriesEntryLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, beaker.server.protobuf.Revisions.EntriesEntry]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, beaker.server.protobuf.Revisions.EntriesEntry](_l) {
      def key: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.getKey)((c_, f_) => c_.copy(key = Option(f_)))
      def optionalKey: _root_.scalapb.lenses.Lens[UpperPB, scala.Option[_root_.scala.Predef.String]] = field(_.key)((c_, f_) => c_.copy(key = f_))
      def value: _root_.scalapb.lenses.Lens[UpperPB, beaker.server.protobuf.Revision] = field(_.getValue)((c_, f_) => c_.copy(value = Option(f_)))
      def optionalValue: _root_.scalapb.lenses.Lens[UpperPB, scala.Option[beaker.server.protobuf.Revision]] = field(_.value)((c_, f_) => c_.copy(value = f_))
    }
    final val KEY_FIELD_NUMBER = 1
    final val VALUE_FIELD_NUMBER = 2
    implicit val keyValueMapper: _root_.scalapb.TypeMapper[beaker.server.protobuf.Revisions.EntriesEntry, (_root_.scala.Predef.String, beaker.server.protobuf.Revision)] =
      _root_.scalapb.TypeMapper[beaker.server.protobuf.Revisions.EntriesEntry, (_root_.scala.Predef.String, beaker.server.protobuf.Revision)](__m => (__m.getKey, __m.getValue))(__p => beaker.server.protobuf.Revisions.EntriesEntry(Some(__p._1), Some(__p._2)))
  }
  
  implicit class RevisionsLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, beaker.server.protobuf.Revisions]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, beaker.server.protobuf.Revisions](_l) {
    def entries: _root_.scalapb.lenses.Lens[UpperPB, scala.collection.immutable.Map[_root_.scala.Predef.String, beaker.server.protobuf.Revision]] = field(_.entries)((c_, f_) => c_.copy(entries = f_))
  }
  final val ENTRIES_FIELD_NUMBER = 1
  @transient
  private val _typemapper_entries: _root_.scalapb.TypeMapper[beaker.server.protobuf.Revisions.EntriesEntry, (_root_.scala.Predef.String, beaker.server.protobuf.Revision)] = implicitly[_root_.scalapb.TypeMapper[beaker.server.protobuf.Revisions.EntriesEntry, (_root_.scala.Predef.String, beaker.server.protobuf.Revision)]]
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy