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

com.google.protobuf.compiler.plugin.Version.scala Maven / Gradle / Ivy

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

package com.google.protobuf.compiler.plugin

/** The version number of protocol compiler.
  *
  * @param suffix
  *   A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
  *   be empty for mainline stable releases.
  */
@SerialVersionUID(0L)
final case class Version(
    major: _root_.scala.Option[_root_.scala.Int] = _root_.scala.None,
    minor: _root_.scala.Option[_root_.scala.Int] = _root_.scala.None,
    patch: _root_.scala.Option[_root_.scala.Int] = _root_.scala.None,
    suffix: _root_.scala.Option[_root_.scala.Predef.String] = _root_.scala.None,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Version] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      if (major.isDefined) {
        val __value = major.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(1, __value)
      };
      if (minor.isDefined) {
        val __value = minor.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(2, __value)
      };
      if (patch.isDefined) {
        val __value = patch.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(3, __value)
      };
      if (suffix.isDefined) {
        val __value = suffix.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(4, __value)
      };
      __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 = {
      major.foreach { __v =>
        val __m = __v
        _output__.writeInt32(1, __m)
      };
      minor.foreach { __v =>
        val __m = __v
        _output__.writeInt32(2, __m)
      };
      patch.foreach { __v =>
        val __m = __v
        _output__.writeInt32(3, __m)
      };
      suffix.foreach { __v =>
        val __m = __v
        _output__.writeString(4, __m)
      };
      unknownFields.writeTo(_output__)
    }
    def getMajor: _root_.scala.Int = major.getOrElse(0)
    def clearMajor: Version = copy(major = _root_.scala.None)
    def withMajor(__v: _root_.scala.Int): Version = copy(major = Option(__v))
    def getMinor: _root_.scala.Int = minor.getOrElse(0)
    def clearMinor: Version = copy(minor = _root_.scala.None)
    def withMinor(__v: _root_.scala.Int): Version = copy(minor = Option(__v))
    def getPatch: _root_.scala.Int = patch.getOrElse(0)
    def clearPatch: Version = copy(patch = _root_.scala.None)
    def withPatch(__v: _root_.scala.Int): Version = copy(patch = Option(__v))
    def getSuffix: _root_.scala.Predef.String = suffix.getOrElse("")
    def clearSuffix: Version = copy(suffix = _root_.scala.None)
    def withSuffix(__v: _root_.scala.Predef.String): Version = copy(suffix = Option(__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 => major.orNull
        case 2 => minor.orNull
        case 3 => patch.orNull
        case 4 => suffix.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 => major.map(_root_.scalapb.descriptors.PInt(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 2 => minor.map(_root_.scalapb.descriptors.PInt(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 3 => patch.map(_root_.scalapb.descriptors.PInt(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 4 => suffix.map(_root_.scalapb.descriptors.PString(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: com.google.protobuf.compiler.plugin.Version.type = com.google.protobuf.compiler.plugin.Version
    // @@protoc_insertion_point(GeneratedMessage[google.protobuf.compiler.Version])
}

object Version extends scalapb.GeneratedMessageCompanion[com.google.protobuf.compiler.plugin.Version] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[com.google.protobuf.compiler.plugin.Version] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): com.google.protobuf.compiler.plugin.Version = {
    var __major: _root_.scala.Option[_root_.scala.Int] = _root_.scala.None
    var __minor: _root_.scala.Option[_root_.scala.Int] = _root_.scala.None
    var __patch: _root_.scala.Option[_root_.scala.Int] = _root_.scala.None
    var __suffix: _root_.scala.Option[_root_.scala.Predef.String] = _root_.scala.None
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 8 =>
          __major = _root_.scala.Option(_input__.readInt32())
        case 16 =>
          __minor = _root_.scala.Option(_input__.readInt32())
        case 24 =>
          __patch = _root_.scala.Option(_input__.readInt32())
        case 34 =>
          __suffix = _root_.scala.Option(_input__.readStringRequireUtf8())
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    com.google.protobuf.compiler.plugin.Version(
        major = __major,
        minor = __minor,
        patch = __patch,
        suffix = __suffix,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[com.google.protobuf.compiler.plugin.Version] = _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.")
      com.google.protobuf.compiler.plugin.Version(
        major = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Int]]),
        minor = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Int]]),
        patch = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Int]]),
        suffix = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Predef.String]])
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = com.google.protobuf.compiler.plugin.PluginProto.javaDescriptor.getMessageTypes().get(0)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = com.google.protobuf.compiler.plugin.PluginProto.scalaDescriptor.messages(0)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number)
  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 = com.google.protobuf.compiler.plugin.Version(
    major = _root_.scala.None,
    minor = _root_.scala.None,
    patch = _root_.scala.None,
    suffix = _root_.scala.None
  )
  implicit class VersionLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.compiler.plugin.Version]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, com.google.protobuf.compiler.plugin.Version](_l) {
    def major: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.getMajor)((c_, f_) => c_.copy(major = _root_.scala.Option(f_)))
    def optionalMajor: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[_root_.scala.Int]] = field(_.major)((c_, f_) => c_.copy(major = f_))
    def minor: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.getMinor)((c_, f_) => c_.copy(minor = _root_.scala.Option(f_)))
    def optionalMinor: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[_root_.scala.Int]] = field(_.minor)((c_, f_) => c_.copy(minor = f_))
    def patch: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.getPatch)((c_, f_) => c_.copy(patch = _root_.scala.Option(f_)))
    def optionalPatch: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[_root_.scala.Int]] = field(_.patch)((c_, f_) => c_.copy(patch = f_))
    def suffix: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.getSuffix)((c_, f_) => c_.copy(suffix = _root_.scala.Option(f_)))
    def optionalSuffix: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[_root_.scala.Predef.String]] = field(_.suffix)((c_, f_) => c_.copy(suffix = f_))
  }
  final val MAJOR_FIELD_NUMBER = 1
  final val MINOR_FIELD_NUMBER = 2
  final val PATCH_FIELD_NUMBER = 3
  final val SUFFIX_FIELD_NUMBER = 4
  def of(
    major: _root_.scala.Option[_root_.scala.Int],
    minor: _root_.scala.Option[_root_.scala.Int],
    patch: _root_.scala.Option[_root_.scala.Int],
    suffix: _root_.scala.Option[_root_.scala.Predef.String]
  ): _root_.com.google.protobuf.compiler.plugin.Version = _root_.com.google.protobuf.compiler.plugin.Version(
    major,
    minor,
    patch,
    suffix
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[google.protobuf.compiler.Version])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy