From 2fdac4c0513cfa279cfbf843f0b8be71244e435a Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 7 Aug 2023 20:40:32 +0000 Subject: [PATCH] Reformat with scalafmt 3.7.12 Executed command: scalafmt --non-interactive --- .../com/thesamet/docs/json/JsonProto.scala | 32 +- .../com/thesamet/docs/json/MyContainer.scala | 175 +++-- .../com/thesamet/docs/json/MyMessage.scala | 166 +++-- .../generated/mytypes/duration/Duration.scala | 166 +++-- .../mytypes/duration/DurationProto.scala | 32 +- .../scalapb/docs/person/Person.scala | 609 ++++++++++-------- .../scalapb/docs/person/PersonProto.scala | 30 +- .../generated/scalapb/perf/protos/Color.scala | 61 +- .../generated/scalapb/perf/protos/Enum.scala | 169 +++-- .../scalapb/perf/protos/EnumVector.scala | 196 +++--- .../scalapb/perf/protos/IntVector.scala | 188 +++--- .../perf/protos/MessageContainer.scala | 234 ++++--- .../scalapb/perf/protos/ProtosProto.scala | 32 +- .../scalapb/perf/protos/SimpleMessage.scala | 334 +++++----- .../scalapb/perf/protos/StringMessage.scala | 221 ++++--- .../src/test/scala/MethodDescriptorSpec.scala | 3 +- 16 files changed, 1551 insertions(+), 1097 deletions(-) diff --git a/docs/src/main/scala/generated/com/thesamet/docs/json/JsonProto.scala b/docs/src/main/scala/generated/com/thesamet/docs/json/JsonProto.scala index dd82a9d95..bd37f237f 100644 --- a/docs/src/main/scala/generated/com/thesamet/docs/json/JsonProto.scala +++ b/docs/src/main/scala/generated/com/thesamet/docs/json/JsonProto.scala @@ -9,27 +9,39 @@ object JsonProto extends _root_.scalapb.GeneratedFileObject { lazy val dependencies: Seq[_root_.scalapb.GeneratedFileObject] = Seq( com.google.protobuf.any.AnyProto ) - lazy val messagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = + lazy val messagesCompanions + : Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]]( com.thesamet.docs.json.MyMessage, com.thesamet.docs.json.MyContainer ) private lazy val ProtoBytes: _root_.scala.Array[Byte] = - scalapb.Encoding.fromBase64(scala.collection.immutable.Seq( - """Cgpqc29uLnByb3RvEhFjb20udGhlc2FtZXQuZG9jcxoZZ29vZ2xlL3Byb3RvYnVmL2FueS5wcm90byIhCglNeU1lc3NhZ2USF + scalapb.Encoding.fromBase64( + scala.collection.immutable + .Seq( + """Cgpqc29uLnByb3RvEhFjb20udGhlc2FtZXQuZG9jcxoZZ29vZ2xlL3Byb3RvYnVmL2FueS5wcm90byIhCglNeU1lc3NhZ2USF AoBeBgBIAEoBUIG4j8DEgF4UgF4IkYKC015Q29udGFpbmVyEjcKBm15X2FueRgBIAEoCzIULmdvb2dsZS5wcm90b2J1Zi5BbnlCC uI/BxIFbXlBbnlSBW15QW55YgZwcm90bzM=""" - ).mkString) + ) + .mkString + ) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) - _root_.scalapb.descriptors.FileDescriptor.buildFrom(scalaProto, dependencies.map(_.scalaDescriptor)) + _root_.scalapb.descriptors.FileDescriptor + .buildFrom(scalaProto, dependencies.map(_.scalaDescriptor)) } lazy val javaDescriptor: com.google.protobuf.Descriptors.FileDescriptor = { val javaProto = com.google.protobuf.DescriptorProtos.FileDescriptorProto.parseFrom(ProtoBytes) - com.google.protobuf.Descriptors.FileDescriptor.buildFrom(javaProto, _root_.scala.Array( - com.google.protobuf.any.AnyProto.javaDescriptor - )) + com.google.protobuf.Descriptors.FileDescriptor.buildFrom( + javaProto, + _root_.scala.Array( + com.google.protobuf.any.AnyProto.javaDescriptor + ) + ) } - @deprecated("Use javaDescriptor instead. In a future version this will refer to scalaDescriptor.", "ScalaPB 0.5.47") + @deprecated( + "Use javaDescriptor instead. In a future version this will refer to scalaDescriptor.", + "ScalaPB 0.5.47" + ) def descriptor: com.google.protobuf.Descriptors.FileDescriptor = javaDescriptor -} \ No newline at end of file +} diff --git a/docs/src/main/scala/generated/com/thesamet/docs/json/MyContainer.scala b/docs/src/main/scala/generated/com/thesamet/docs/json/MyContainer.scala index 98d444961..d370726b1 100644 --- a/docs/src/main/scala/generated/com/thesamet/docs/json/MyContainer.scala +++ b/docs/src/main/scala/generated/com/thesamet/docs/json/MyContainer.scala @@ -9,69 +9,82 @@ package com.thesamet.docs.json final case class MyContainer( myAny: _root_.scala.Option[com.google.protobuf.any.Any] = _root_.scala.None, unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty - ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[MyContainer] { - @transient - private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 - private[this] def __computeSerializedSize(): _root_.scala.Int = { - var __size = 0 - if (myAny.isDefined) { - val __value = myAny.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 = { - myAny.foreach { __v => - val __m = __v - _output__.writeTag(1, 2) - _output__.writeUInt32NoTag(__m.serializedSize) - __m.writeTo(_output__) - }; - unknownFields.writeTo(_output__) +) extends scalapb.GeneratedMessage + with scalapb.lenses.Updatable[MyContainer] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + if (myAny.isDefined) { + val __value = myAny.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 } - def getMyAny: com.google.protobuf.any.Any = myAny.getOrElse(com.google.protobuf.any.Any.defaultInstance) - def clearMyAny: MyContainer = copy(myAny = _root_.scala.None) - def withMyAny(__v: com.google.protobuf.any.Any): MyContainer = copy(myAny = 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 => myAny.orNull - } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + myAny.foreach { __v => + val __m = __v + _output__.writeTag(1, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def getMyAny: com.google.protobuf.any.Any = + myAny.getOrElse(com.google.protobuf.any.Any.defaultInstance) + def clearMyAny: MyContainer = copy(myAny = _root_.scala.None) + def withMyAny(__v: com.google.protobuf.any.Any): MyContainer = copy(myAny = 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 => myAny.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 => myAny.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) - } + } + 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 => myAny.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) } - def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) - def companion: com.thesamet.docs.json.MyContainer.type = com.thesamet.docs.json.MyContainer - // @@protoc_insertion_point(GeneratedMessage[com.thesamet.docs.MyContainer]) + } + def toProtoString: _root_.scala.Predef.String = + _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: com.thesamet.docs.json.MyContainer.type = com.thesamet.docs.json.MyContainer + // @@protoc_insertion_point(GeneratedMessage[com.thesamet.docs.MyContainer]) } object MyContainer extends scalapb.GeneratedMessageCompanion[com.thesamet.docs.json.MyContainer] { - implicit def messageCompanion: scalapb.GeneratedMessageCompanion[com.thesamet.docs.json.MyContainer] = this - def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): com.thesamet.docs.json.MyContainer = { - var __myAny: _root_.scala.Option[com.google.protobuf.any.Any] = _root_.scala.None - var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null - var _done__ = false + implicit def messageCompanion + : scalapb.GeneratedMessageCompanion[com.thesamet.docs.json.MyContainer] = this + def parseFrom( + `_input__`: _root_.com.google.protobuf.CodedInputStream + ): com.thesamet.docs.json.MyContainer = { + var __myAny: _root_.scala.Option[com.google.protobuf.any.Any] = _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 10 => - __myAny = Option(__myAny.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.any.Any](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __myAny = Option( + __myAny.fold( + _root_.scalapb.LiteParser.readMessage[com.google.protobuf.any.Any](_input__) + )(_root_.scalapb.LiteParser.readMessage(_input__, _)) + ) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -80,39 +93,59 @@ object MyContainer extends scalapb.GeneratedMessageCompanion[com.thesamet.docs.j } } com.thesamet.docs.json.MyContainer( - myAny = __myAny, - unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + myAny = __myAny, + unknownFields = + if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty + else _unknownFields__.result() ) } - implicit def messageReads: _root_.scalapb.descriptors.Reads[com.thesamet.docs.json.MyContainer] = _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.thesamet.docs.json.MyContainer( - myAny = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[com.google.protobuf.any.Any]]) - ) - case _ => throw new RuntimeException("Expected PMessage") - } - def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = JsonProto.javaDescriptor.getMessageTypes().get(1) + implicit def messageReads: _root_.scalapb.descriptors.Reads[com.thesamet.docs.json.MyContainer] = + _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.thesamet.docs.json.MyContainer( + myAny = __fieldsMap + .get(scalaDescriptor.findFieldByNumber(1).get) + .flatMap(_.as[_root_.scala.Option[com.google.protobuf.any.Any]]) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = + JsonProto.javaDescriptor.getMessageTypes().get(1) def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = JsonProto.scalaDescriptor.messages(1) - def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + def messageCompanionForFieldNumber( + __number: _root_.scala.Int + ): _root_.scalapb.GeneratedMessageCompanion[_] = { var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null - (__number: @_root_.scala.unchecked) match { + (__number: @ _root_.scala.unchecked) match { case 1 => __out = com.google.protobuf.any.Any } __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 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.thesamet.docs.json.MyContainer( myAny = _root_.scala.None ) - implicit class MyContainerLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, com.thesamet.docs.json.MyContainer]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, com.thesamet.docs.json.MyContainer](_l) { - def myAny: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.any.Any] = field(_.getMyAny)((c_, f_) => c_.copy(myAny = Option(f_))) - def optionalMyAny: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.any.Any]] = field(_.myAny)((c_, f_) => c_.copy(myAny = f_)) + implicit class MyContainerLens[UpperPB]( + _l: _root_.scalapb.lenses.Lens[UpperPB, com.thesamet.docs.json.MyContainer] + ) extends _root_.scalapb.lenses.ObjectLens[UpperPB, com.thesamet.docs.json.MyContainer](_l) { + def myAny: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.any.Any] = + field(_.getMyAny)((c_, f_) => c_.copy(myAny = Option(f_))) + def optionalMyAny + : _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.any.Any]] = + field(_.myAny)((c_, f_) => c_.copy(myAny = f_)) } final val MY_ANY_FIELD_NUMBER = 1 def of( - myAny: _root_.scala.Option[com.google.protobuf.any.Any] + myAny: _root_.scala.Option[com.google.protobuf.any.Any] ): _root_.com.thesamet.docs.json.MyContainer = _root_.com.thesamet.docs.json.MyContainer( myAny ) diff --git a/docs/src/main/scala/generated/com/thesamet/docs/json/MyMessage.scala b/docs/src/main/scala/generated/com/thesamet/docs/json/MyMessage.scala index 6e1777b6e..5911a30cf 100644 --- a/docs/src/main/scala/generated/com/thesamet/docs/json/MyMessage.scala +++ b/docs/src/main/scala/generated/com/thesamet/docs/json/MyMessage.scala @@ -9,67 +9,74 @@ package com.thesamet.docs.json final case class MyMessage( x: _root_.scala.Int = 0, unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty - ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[MyMessage] { - @transient - private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 - private[this] def __computeSerializedSize(): _root_.scala.Int = { - var __size = 0 - - { - val __value = x - if (__value != 0) { - __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(1, __value) - } - }; - __size += unknownFields.serializedSize - __size - } - override def serializedSize: _root_.scala.Int = { - var __size = __serializedSizeMemoized - if (__size == 0) { - __size = __computeSerializedSize() + 1 - __serializedSizeMemoized = __size +) extends scalapb.GeneratedMessage + with scalapb.lenses.Updatable[MyMessage] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = x + if (__value != 0) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(1, __value) } - __size - 1 - - } - def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { - { - val __v = x - if (__v != 0) { - _output__.writeInt32(1, __v) - } - }; - unknownFields.writeTo(_output__) + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size } - def withX(__v: _root_.scala.Int): MyMessage = copy(x = __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 => { - val __t = x - if (__t != 0) __t else null - } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = x + if (__v != 0) { + _output__.writeInt32(1, __v) } - } - 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.PInt(x) + }; + unknownFields.writeTo(_output__) + } + def withX(__v: _root_.scala.Int): MyMessage = copy(x = __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 => { + val __t = x + if (__t != 0) __t else null } } - def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) - def companion: com.thesamet.docs.json.MyMessage.type = com.thesamet.docs.json.MyMessage - // @@protoc_insertion_point(GeneratedMessage[com.thesamet.docs.MyMessage]) + } + 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.PInt(x) + } + } + def toProtoString: _root_.scala.Predef.String = + _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: com.thesamet.docs.json.MyMessage.type = com.thesamet.docs.json.MyMessage + // @@protoc_insertion_point(GeneratedMessage[com.thesamet.docs.MyMessage]) } object MyMessage extends scalapb.GeneratedMessageCompanion[com.thesamet.docs.json.MyMessage] { - implicit def messageCompanion: scalapb.GeneratedMessageCompanion[com.thesamet.docs.json.MyMessage] = this - def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): com.thesamet.docs.json.MyMessage = { - var __x: _root_.scala.Int = 0 - var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null - var _done__ = false + implicit def messageCompanion + : scalapb.GeneratedMessageCompanion[com.thesamet.docs.json.MyMessage] = this + def parseFrom( + `_input__`: _root_.com.google.protobuf.CodedInputStream + ): com.thesamet.docs.json.MyMessage = { + var __x: _root_.scala.Int = 0 + var `_unknownFields__` : _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false while (!_done__) { val _tag__ = _input__.readTag() _tag__ match { @@ -84,32 +91,51 @@ object MyMessage extends scalapb.GeneratedMessageCompanion[com.thesamet.docs.jso } } com.thesamet.docs.json.MyMessage( - x = __x, - unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + x = __x, + unknownFields = + if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty + else _unknownFields__.result() ) } - implicit def messageReads: _root_.scalapb.descriptors.Reads[com.thesamet.docs.json.MyMessage] = _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.thesamet.docs.json.MyMessage( - x = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Int]).getOrElse(0) - ) - case _ => throw new RuntimeException("Expected PMessage") - } - def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = JsonProto.javaDescriptor.getMessageTypes().get(0) + implicit def messageReads: _root_.scalapb.descriptors.Reads[com.thesamet.docs.json.MyMessage] = + _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.thesamet.docs.json.MyMessage( + x = __fieldsMap + .get(scalaDescriptor.findFieldByNumber(1).get) + .map(_.as[_root_.scala.Int]) + .getOrElse(0) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = + JsonProto.javaDescriptor.getMessageTypes().get(0) def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = JsonProto.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) + 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.thesamet.docs.json.MyMessage( x = 0 ) - implicit class MyMessageLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, com.thesamet.docs.json.MyMessage]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, com.thesamet.docs.json.MyMessage](_l) { - def x: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.x)((c_, f_) => c_.copy(x = f_)) + implicit class MyMessageLens[UpperPB]( + _l: _root_.scalapb.lenses.Lens[UpperPB, com.thesamet.docs.json.MyMessage] + ) extends _root_.scalapb.lenses.ObjectLens[UpperPB, com.thesamet.docs.json.MyMessage](_l) { + def x: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = + field(_.x)((c_, f_) => c_.copy(x = f_)) } final val X_FIELD_NUMBER = 1 def of( - x: _root_.scala.Int + x: _root_.scala.Int ): _root_.com.thesamet.docs.json.MyMessage = _root_.com.thesamet.docs.json.MyMessage( x ) diff --git a/docs/src/main/scala/generated/mytypes/duration/Duration.scala b/docs/src/main/scala/generated/mytypes/duration/Duration.scala index 7c931f9e1..e35dfefed 100644 --- a/docs/src/main/scala/generated/mytypes/duration/Duration.scala +++ b/docs/src/main/scala/generated/mytypes/duration/Duration.scala @@ -9,67 +9,73 @@ package mytypes.duration final case class Duration( seconds: _root_.scala.Int = 0, unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty - ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Duration] { - @transient - private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 - private[this] def __computeSerializedSize(): _root_.scala.Int = { - var __size = 0 - - { - val __value = seconds - if (__value != 0) { - __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(1, __value) - } - }; - __size += unknownFields.serializedSize - __size - } - override def serializedSize: _root_.scala.Int = { - var __size = __serializedSizeMemoized - if (__size == 0) { - __size = __computeSerializedSize() + 1 - __serializedSizeMemoized = __size +) extends scalapb.GeneratedMessage + with scalapb.lenses.Updatable[Duration] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = seconds + if (__value != 0) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(1, __value) } - __size - 1 - - } - def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { - { - val __v = seconds - if (__v != 0) { - _output__.writeInt32(1, __v) - } - }; - unknownFields.writeTo(_output__) + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size } - def withSeconds(__v: _root_.scala.Int): Duration = copy(seconds = __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 => { - val __t = seconds - if (__t != 0) __t else null - } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = seconds + if (__v != 0) { + _output__.writeInt32(1, __v) } - } - 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.PInt(seconds) + }; + unknownFields.writeTo(_output__) + } + def withSeconds(__v: _root_.scala.Int): Duration = copy(seconds = __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 => { + val __t = seconds + if (__t != 0) __t else null } } - def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) - def companion: mytypes.duration.Duration.type = mytypes.duration.Duration - // @@protoc_insertion_point(GeneratedMessage[mytypes.Duration]) + } + 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.PInt(seconds) + } + } + def toProtoString: _root_.scala.Predef.String = + _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: mytypes.duration.Duration.type = mytypes.duration.Duration + // @@protoc_insertion_point(GeneratedMessage[mytypes.Duration]) } object Duration extends scalapb.GeneratedMessageCompanion[mytypes.duration.Duration] { implicit def messageCompanion: scalapb.GeneratedMessageCompanion[mytypes.duration.Duration] = this - def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): mytypes.duration.Duration = { - var __seconds: _root_.scala.Int = 0 - var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null - var _done__ = false + def parseFrom( + `_input__`: _root_.com.google.protobuf.CodedInputStream + ): mytypes.duration.Duration = { + var __seconds: _root_.scala.Int = 0 + var `_unknownFields__` : _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false while (!_done__) { val _tag__ = _input__.readTag() _tag__ match { @@ -84,32 +90,52 @@ object Duration extends scalapb.GeneratedMessageCompanion[mytypes.duration.Durat } } mytypes.duration.Duration( - seconds = __seconds, - unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + seconds = __seconds, + unknownFields = + if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty + else _unknownFields__.result() ) } - implicit def messageReads: _root_.scalapb.descriptors.Reads[mytypes.duration.Duration] = _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.") - mytypes.duration.Duration( - seconds = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Int]).getOrElse(0) - ) - case _ => throw new RuntimeException("Expected PMessage") - } - def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = DurationProto.javaDescriptor.getMessageTypes().get(0) - def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = DurationProto.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) + implicit def messageReads: _root_.scalapb.descriptors.Reads[mytypes.duration.Duration] = + _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." + ) + mytypes.duration.Duration( + seconds = __fieldsMap + .get(scalaDescriptor.findFieldByNumber(1).get) + .map(_.as[_root_.scala.Int]) + .getOrElse(0) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = + DurationProto.javaDescriptor.getMessageTypes().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = + DurationProto.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 = mytypes.duration.Duration( seconds = 0 ) - implicit class DurationLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, mytypes.duration.Duration]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, mytypes.duration.Duration](_l) { - def seconds: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.seconds)((c_, f_) => c_.copy(seconds = f_)) + implicit class DurationLens[UpperPB]( + _l: _root_.scalapb.lenses.Lens[UpperPB, mytypes.duration.Duration] + ) extends _root_.scalapb.lenses.ObjectLens[UpperPB, mytypes.duration.Duration](_l) { + def seconds: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = + field(_.seconds)((c_, f_) => c_.copy(seconds = f_)) } final val SECONDS_FIELD_NUMBER = 1 def of( - seconds: _root_.scala.Int + seconds: _root_.scala.Int ): _root_.mytypes.duration.Duration = _root_.mytypes.duration.Duration( seconds ) diff --git a/docs/src/main/scala/generated/mytypes/duration/DurationProto.scala b/docs/src/main/scala/generated/mytypes/duration/DurationProto.scala index 8d0a2b842..8173e2ba6 100644 --- a/docs/src/main/scala/generated/mytypes/duration/DurationProto.scala +++ b/docs/src/main/scala/generated/mytypes/duration/DurationProto.scala @@ -9,25 +9,37 @@ object DurationProto extends _root_.scalapb.GeneratedFileObject { lazy val dependencies: Seq[_root_.scalapb.GeneratedFileObject] = Seq( scalapb.options.ScalapbProto ) - lazy val messagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = + lazy val messagesCompanions + : Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]]( mytypes.duration.Duration ) private lazy val ProtoBytes: _root_.scala.Array[Byte] = - scalapb.Encoding.fromBase64(scala.collection.immutable.Seq( - """Cg5kdXJhdGlvbi5wcm90bxIHbXl0eXBlcxoVc2NhbGFwYi9zY2FsYXBiLnByb3RvIk8KCER1cmF0aW9uEiYKB3NlY29uZHMYA + scalapb.Encoding.fromBase64( + scala.collection.immutable + .Seq( + """Cg5kdXJhdGlvbi5wcm90bxIHbXl0eXBlcxoVc2NhbGFwYi9zY2FsYXBiLnByb3RvIk8KCER1cmF0aW9uEiYKB3NlY29uZHMYA SABKAVCDOI/CRIHc2Vjb25kc1IHc2Vjb25kczob4j8YIhZteXR5cGVzLk15RHVyYXRpb25UeXBlYgZwcm90bzM=""" - ).mkString) + ) + .mkString + ) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) - _root_.scalapb.descriptors.FileDescriptor.buildFrom(scalaProto, dependencies.map(_.scalaDescriptor)) + _root_.scalapb.descriptors.FileDescriptor + .buildFrom(scalaProto, dependencies.map(_.scalaDescriptor)) } lazy val javaDescriptor: com.google.protobuf.Descriptors.FileDescriptor = { val javaProto = com.google.protobuf.DescriptorProtos.FileDescriptorProto.parseFrom(ProtoBytes) - com.google.protobuf.Descriptors.FileDescriptor.buildFrom(javaProto, _root_.scala.Array( - scalapb.options.ScalapbProto.javaDescriptor - )) + com.google.protobuf.Descriptors.FileDescriptor.buildFrom( + javaProto, + _root_.scala.Array( + scalapb.options.ScalapbProto.javaDescriptor + ) + ) } - @deprecated("Use javaDescriptor instead. In a future version this will refer to scalaDescriptor.", "ScalaPB 0.5.47") + @deprecated( + "Use javaDescriptor instead. In a future version this will refer to scalaDescriptor.", + "ScalaPB 0.5.47" + ) def descriptor: com.google.protobuf.Descriptors.FileDescriptor = javaDescriptor -} \ No newline at end of file +} diff --git a/docs/src/main/scala/generated/scalapb/docs/person/Person.scala b/docs/src/main/scala/generated/scalapb/docs/person/Person.scala index cd61f24a9..fa76715d1 100644 --- a/docs/src/main/scala/generated/scalapb/docs/person/Person.scala +++ b/docs/src/main/scala/generated/scalapb/docs/person/Person.scala @@ -11,104 +11,116 @@ final case class Person( age: _root_.scala.Int = 0, addresses: _root_.scala.Seq[scalapb.docs.person.Person.Address] = _root_.scala.Seq.empty, unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty - ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Person] { - @transient - private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 - private[this] def __computeSerializedSize(): _root_.scala.Int = { - var __size = 0 - - { - val __value = name - if (!__value.isEmpty) { - __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) - } - }; - - { - val __value = age - if (__value != 0) { - __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(2, __value) - } - }; - addresses.foreach { __item => - val __value = __item - __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize +) extends scalapb.GeneratedMessage + with scalapb.lenses.Updatable[Person] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = name + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) } - __size += unknownFields.serializedSize - __size - } - override def serializedSize: _root_.scala.Int = { - var __size = __serializedSizeMemoized - if (__size == 0) { - __size = __computeSerializedSize() + 1 - __serializedSizeMemoized = __size + }; + + { + val __value = age + if (__value != 0) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(2, __value) } - __size - 1 - + }; + addresses.foreach { __item => + val __value = __item + __size += 1 + _root_.com.google.protobuf.CodedOutputStream + .computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize } - def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { - { - val __v = name - if (!__v.isEmpty) { - _output__.writeString(1, __v) - } - }; - { - val __v = age - if (__v != 0) { - _output__.writeInt32(2, __v) - } - }; - addresses.foreach { __v => - val __m = __v - _output__.writeTag(3, 2) - _output__.writeUInt32NoTag(__m.serializedSize) - __m.writeTo(_output__) - }; - unknownFields.writeTo(_output__) + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size } - def withName(__v: _root_.scala.Predef.String): Person = copy(name = __v) - def withAge(__v: _root_.scala.Int): Person = copy(age = __v) - def clearAddresses = copy(addresses = _root_.scala.Seq.empty) - def addAddresses(__vs: scalapb.docs.person.Person.Address *): Person = addAllAddresses(__vs) - def addAllAddresses(__vs: Iterable[scalapb.docs.person.Person.Address]): Person = copy(addresses = addresses ++ __vs) - def withAddresses(__v: _root_.scala.Seq[scalapb.docs.person.Person.Address]): Person = copy(addresses = __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 => { - val __t = name - if (__t != "") __t else null - } - case 2 => { - val __t = age - if (__t != 0) __t else null - } - case 3 => addresses + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = name + if (!__v.isEmpty) { + _output__.writeString(1, __v) } - } - 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.PString(name) - case 2 => _root_.scalapb.descriptors.PInt(age) - case 3 => _root_.scalapb.descriptors.PRepeated(addresses.iterator.map(_.toPMessage).toVector) + }; + { + val __v = age + if (__v != 0) { + _output__.writeInt32(2, __v) + } + }; + addresses.foreach { __v => + val __m = __v + _output__.writeTag(3, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def withName(__v: _root_.scala.Predef.String): Person = copy(name = __v) + def withAge(__v: _root_.scala.Int): Person = copy(age = __v) + def clearAddresses = copy(addresses = _root_.scala.Seq.empty) + def addAddresses(__vs: scalapb.docs.person.Person.Address*): Person = addAllAddresses(__vs) + def addAllAddresses(__vs: Iterable[scalapb.docs.person.Person.Address]): Person = + copy(addresses = addresses ++ __vs) + def withAddresses(__v: _root_.scala.Seq[scalapb.docs.person.Person.Address]): Person = + copy(addresses = __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 => { + val __t = name + if (__t != "") __t else null } + case 2 => { + val __t = age + if (__t != 0) __t else null + } + case 3 => addresses + } + } + 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.PString(name) + case 2 => _root_.scalapb.descriptors.PInt(age) + case 3 => _root_.scalapb.descriptors.PRepeated(addresses.iterator.map(_.toPMessage).toVector) } - def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) - def companion: scalapb.docs.person.Person.type = scalapb.docs.person.Person - // @@protoc_insertion_point(GeneratedMessage[scalapb.docs.Person]) + } + def toProtoString: _root_.scala.Predef.String = + _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: scalapb.docs.person.Person.type = scalapb.docs.person.Person + // @@protoc_insertion_point(GeneratedMessage[scalapb.docs.Person]) } object Person extends scalapb.GeneratedMessageCompanion[scalapb.docs.person.Person] { - implicit def messageCompanion: scalapb.GeneratedMessageCompanion[scalapb.docs.person.Person] = this - def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): scalapb.docs.person.Person = { + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[scalapb.docs.person.Person] = + this + def parseFrom( + `_input__`: _root_.com.google.protobuf.CodedInputStream + ): scalapb.docs.person.Person = { var __name: _root_.scala.Predef.String = "" - var __age: _root_.scala.Int = 0 - val __addresses: _root_.scala.collection.immutable.VectorBuilder[scalapb.docs.person.Person.Address] = new _root_.scala.collection.immutable.VectorBuilder[scalapb.docs.person.Person.Address] - var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null - var _done__ = false + var __age: _root_.scala.Int = 0 + val __addresses + : _root_.scala.collection.immutable.VectorBuilder[scalapb.docs.person.Person.Address] = + new _root_.scala.collection.immutable.VectorBuilder[scalapb.docs.person.Person.Address] + var `_unknownFields__` : _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false while (!_done__) { val _tag__ = _input__.readTag() _tag__ match { @@ -118,7 +130,8 @@ object Person extends scalapb.GeneratedMessageCompanion[scalapb.docs.person.Pers case 16 => __age = _input__.readInt32() case 26 => - __addresses += _root_.scalapb.LiteParser.readMessage[scalapb.docs.person.Person.Address](_input__) + __addresses += _root_.scalapb.LiteParser + .readMessage[scalapb.docs.person.Person.Address](_input__) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -127,186 +140,226 @@ object Person extends scalapb.GeneratedMessageCompanion[scalapb.docs.person.Pers } } scalapb.docs.person.Person( - name = __name, - age = __age, - addresses = __addresses.result(), - unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + name = __name, + age = __age, + addresses = __addresses.result(), + unknownFields = + if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty + else _unknownFields__.result() ) } - implicit def messageReads: _root_.scalapb.descriptors.Reads[scalapb.docs.person.Person] = _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.") - scalapb.docs.person.Person( - name = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), - age = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Int]).getOrElse(0), - addresses = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Seq[scalapb.docs.person.Person.Address]]).getOrElse(_root_.scala.Seq.empty) - ) - case _ => throw new RuntimeException("Expected PMessage") - } - def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = PersonProto.javaDescriptor.getMessageTypes().get(0) - def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = PersonProto.scalaDescriptor.messages(0) - def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + implicit def messageReads: _root_.scalapb.descriptors.Reads[scalapb.docs.person.Person] = + _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." + ) + scalapb.docs.person.Person( + name = __fieldsMap + .get(scalaDescriptor.findFieldByNumber(1).get) + .map(_.as[_root_.scala.Predef.String]) + .getOrElse(""), + age = __fieldsMap + .get(scalaDescriptor.findFieldByNumber(2).get) + .map(_.as[_root_.scala.Int]) + .getOrElse(0), + addresses = __fieldsMap + .get(scalaDescriptor.findFieldByNumber(3).get) + .map(_.as[_root_.scala.Seq[scalapb.docs.person.Person.Address]]) + .getOrElse(_root_.scala.Seq.empty) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = + PersonProto.javaDescriptor.getMessageTypes().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = + PersonProto.scalaDescriptor.messages(0) + def messageCompanionForFieldNumber( + __number: _root_.scala.Int + ): _root_.scalapb.GeneratedMessageCompanion[_] = { var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null - (__number: @_root_.scala.unchecked) match { + (__number: @ _root_.scala.unchecked) match { case 3 => __out = scalapb.docs.person.Person.Address } __out } - lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = + lazy val nestedMessagesCompanions + : Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]]( _root_.scalapb.docs.person.Person.Address ) - def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + def enumCompanionForFieldNumber( + __fieldNumber: _root_.scala.Int + ): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) lazy val defaultInstance = scalapb.docs.person.Person( name = "", age = 0, addresses = _root_.scala.Seq.empty ) - sealed abstract class AddressType(val value: _root_.scala.Int) extends _root_.scalapb.GeneratedEnum { - type EnumType = AddressType + sealed abstract class AddressType(val value: _root_.scala.Int) + extends _root_.scalapb.GeneratedEnum { + type EnumType = AddressType type RecognizedType = scalapb.docs.person.Person.AddressType.Recognized def isHome: _root_.scala.Boolean = false def isWork: _root_.scala.Boolean = false - def companion: _root_.scalapb.GeneratedEnumCompanion[AddressType] = scalapb.docs.person.Person.AddressType - final def asRecognized: _root_.scala.Option[scalapb.docs.person.Person.AddressType.Recognized] = if (isUnrecognized) _root_.scala.None else _root_.scala.Some(this.asInstanceOf[scalapb.docs.person.Person.AddressType.Recognized]) + def companion: _root_.scalapb.GeneratedEnumCompanion[AddressType] = + scalapb.docs.person.Person.AddressType + final def asRecognized: _root_.scala.Option[scalapb.docs.person.Person.AddressType.Recognized] = + if (isUnrecognized) _root_.scala.None + else _root_.scala.Some(this.asInstanceOf[scalapb.docs.person.Person.AddressType.Recognized]) } - + object AddressType extends _root_.scalapb.GeneratedEnumCompanion[AddressType] { sealed trait Recognized extends AddressType implicit def enumCompanion: _root_.scalapb.GeneratedEnumCompanion[AddressType] = this - + @SerialVersionUID(0L) case object HOME extends AddressType(0) with AddressType.Recognized { - val index = 0 - val name = "HOME" + val index = 0 + val name = "HOME" override def isHome: _root_.scala.Boolean = true } - + @SerialVersionUID(0L) case object WORK extends AddressType(1) with AddressType.Recognized { - val index = 1 - val name = "WORK" + val index = 1 + val name = "WORK" override def isWork: _root_.scala.Boolean = true } - + @SerialVersionUID(0L) - final case class Unrecognized(unrecognizedValue: _root_.scala.Int) extends AddressType(unrecognizedValue) with _root_.scalapb.UnrecognizedEnum + final case class Unrecognized(unrecognizedValue: _root_.scala.Int) + extends AddressType(unrecognizedValue) + with _root_.scalapb.UnrecognizedEnum lazy val values = scala.collection.immutable.Seq(HOME, WORK) def fromValue(__value: _root_.scala.Int): AddressType = __value match { - case 0 => HOME - case 1 => WORK + case 0 => HOME + case 1 => WORK case __other => Unrecognized(__other) } - def javaDescriptor: _root_.com.google.protobuf.Descriptors.EnumDescriptor = scalapb.docs.person.Person.javaDescriptor.getEnumTypes().get(0) - def scalaDescriptor: _root_.scalapb.descriptors.EnumDescriptor = scalapb.docs.person.Person.scalaDescriptor.enums(0) + def javaDescriptor: _root_.com.google.protobuf.Descriptors.EnumDescriptor = + scalapb.docs.person.Person.javaDescriptor.getEnumTypes().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.EnumDescriptor = + scalapb.docs.person.Person.scalaDescriptor.enums(0) } @SerialVersionUID(0L) final case class Address( - addressType: scalapb.docs.person.Person.AddressType = scalapb.docs.person.Person.AddressType.HOME, + addressType: scalapb.docs.person.Person.AddressType = + scalapb.docs.person.Person.AddressType.HOME, street: _root_.scala.Predef.String = "", city: _root_.scala.Predef.String = "", unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty - ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Address] { - @transient - private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 - private[this] def __computeSerializedSize(): _root_.scala.Int = { - var __size = 0 - - { - val __value = addressType.value - if (__value != 0) { - __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(1, __value) - } - }; - - { - val __value = street - if (!__value.isEmpty) { - __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) - } - }; - - { - val __value = city - if (!__value.isEmpty) { - __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __value) - } - }; - __size += unknownFields.serializedSize - __size - } - override def serializedSize: _root_.scala.Int = { - var __size = __serializedSizeMemoized - if (__size == 0) { - __size = __computeSerializedSize() + 1 - __serializedSizeMemoized = __size + ) extends scalapb.GeneratedMessage + with scalapb.lenses.Updatable[Address] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = addressType.value + if (__value != 0) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(1, __value) } - __size - 1 - - } - def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { - { - val __v = addressType.value - if (__v != 0) { - _output__.writeEnum(1, __v) - } - }; - { - val __v = street - if (!__v.isEmpty) { - _output__.writeString(2, __v) - } - }; - { - val __v = city - if (!__v.isEmpty) { - _output__.writeString(3, __v) - } - }; - unknownFields.writeTo(_output__) - } - def withAddressType(__v: scalapb.docs.person.Person.AddressType): Address = copy(addressType = __v) - def withStreet(__v: _root_.scala.Predef.String): Address = copy(street = __v) - def withCity(__v: _root_.scala.Predef.String): Address = copy(city = __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 => { - val __t = addressType.javaValueDescriptor - if (__t.getNumber() != 0) __t else null - } - case 2 => { - val __t = street - if (__t != "") __t else null - } - case 3 => { - val __t = city - if (__t != "") __t else null - } + }; + + { + val __value = street + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) } + }; + + { + val __value = city + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size } - 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.PEnum(addressType.scalaValueDescriptor) - case 2 => _root_.scalapb.descriptors.PString(street) - case 3 => _root_.scalapb.descriptors.PString(city) + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = addressType.value + if (__v != 0) { + _output__.writeEnum(1, __v) + } + }; + { + val __v = street + if (!__v.isEmpty) { + _output__.writeString(2, __v) + } + }; + { + val __v = city + if (!__v.isEmpty) { + _output__.writeString(3, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withAddressType(__v: scalapb.docs.person.Person.AddressType): Address = + copy(addressType = __v) + def withStreet(__v: _root_.scala.Predef.String): Address = copy(street = __v) + def withCity(__v: _root_.scala.Predef.String): Address = copy(city = __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 => { + val __t = addressType.javaValueDescriptor + if (__t.getNumber() != 0) __t else null } + case 2 => { + val __t = street + if (__t != "") __t else null + } + case 3 => { + val __t = city + if (__t != "") __t else null + } + } + } + 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.PEnum(addressType.scalaValueDescriptor) + case 2 => _root_.scalapb.descriptors.PString(street) + case 3 => _root_.scalapb.descriptors.PString(city) } - def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) - def companion: scalapb.docs.person.Person.Address.type = scalapb.docs.person.Person.Address - // @@protoc_insertion_point(GeneratedMessage[scalapb.docs.Person.Address]) + } + def toProtoString: _root_.scala.Predef.String = + _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: scalapb.docs.person.Person.Address.type = scalapb.docs.person.Person.Address + // @@protoc_insertion_point(GeneratedMessage[scalapb.docs.Person.Address]) } - + object Address extends scalapb.GeneratedMessageCompanion[scalapb.docs.person.Person.Address] { - implicit def messageCompanion: scalapb.GeneratedMessageCompanion[scalapb.docs.person.Person.Address] = this - def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): scalapb.docs.person.Person.Address = { - var __addressType: scalapb.docs.person.Person.AddressType = scalapb.docs.person.Person.AddressType.HOME - var __street: _root_.scala.Predef.String = "" - var __city: _root_.scala.Predef.String = "" - var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null - var _done__ = false + implicit def messageCompanion + : scalapb.GeneratedMessageCompanion[scalapb.docs.person.Person.Address] = this + def parseFrom( + `_input__`: _root_.com.google.protobuf.CodedInputStream + ): scalapb.docs.person.Person.Address = { + var __addressType: scalapb.docs.person.Person.AddressType = + scalapb.docs.person.Person.AddressType.HOME + var __street: _root_.scala.Predef.String = "" + var __city: _root_.scala.Predef.String = "" + var `_unknownFields__` : _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false while (!_done__) { val _tag__ = _input__.readTag() _tag__ match { @@ -325,28 +378,55 @@ object Person extends scalapb.GeneratedMessageCompanion[scalapb.docs.person.Pers } } scalapb.docs.person.Person.Address( - addressType = __addressType, - street = __street, - city = __city, - unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + addressType = __addressType, + street = __street, + city = __city, + unknownFields = + if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty + else _unknownFields__.result() ) } - implicit def messageReads: _root_.scalapb.descriptors.Reads[scalapb.docs.person.Person.Address] = _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.") - scalapb.docs.person.Person.Address( - addressType = scalapb.docs.person.Person.AddressType.fromValue(__fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scalapb.descriptors.EnumValueDescriptor]).getOrElse(scalapb.docs.person.Person.AddressType.HOME.scalaValueDescriptor).number), - street = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), - city = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Predef.String]).getOrElse("") - ) - case _ => throw new RuntimeException("Expected PMessage") - } - def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = scalapb.docs.person.Person.javaDescriptor.getNestedTypes().get(0) - def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = scalapb.docs.person.Person.scalaDescriptor.nestedMessages(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[_] = { - (__fieldNumber: @_root_.scala.unchecked) match { + implicit def messageReads + : _root_.scalapb.descriptors.Reads[scalapb.docs.person.Person.Address] = + _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." + ) + scalapb.docs.person.Person.Address( + addressType = scalapb.docs.person.Person.AddressType.fromValue( + __fieldsMap + .get(scalaDescriptor.findFieldByNumber(1).get) + .map(_.as[_root_.scalapb.descriptors.EnumValueDescriptor]) + .getOrElse(scalapb.docs.person.Person.AddressType.HOME.scalaValueDescriptor) + .number + ), + street = __fieldsMap + .get(scalaDescriptor.findFieldByNumber(2).get) + .map(_.as[_root_.scala.Predef.String]) + .getOrElse(""), + city = __fieldsMap + .get(scalaDescriptor.findFieldByNumber(3).get) + .map(_.as[_root_.scala.Predef.String]) + .getOrElse("") + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = + scalapb.docs.person.Person.javaDescriptor.getNestedTypes().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = + scalapb.docs.person.Person.scalaDescriptor.nestedMessages(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[_] = { + (__fieldNumber: @ _root_.scala.unchecked) match { case 1 => scalapb.docs.person.Person.AddressType } } @@ -355,18 +435,23 @@ object Person extends scalapb.GeneratedMessageCompanion[scalapb.docs.person.Pers street = "", city = "" ) - implicit class AddressLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, scalapb.docs.person.Person.Address]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, scalapb.docs.person.Person.Address](_l) { - def addressType: _root_.scalapb.lenses.Lens[UpperPB, scalapb.docs.person.Person.AddressType] = field(_.addressType)((c_, f_) => c_.copy(addressType = f_)) - def street: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.street)((c_, f_) => c_.copy(street = f_)) - def city: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.city)((c_, f_) => c_.copy(city = f_)) + implicit class AddressLens[UpperPB]( + _l: _root_.scalapb.lenses.Lens[UpperPB, scalapb.docs.person.Person.Address] + ) extends _root_.scalapb.lenses.ObjectLens[UpperPB, scalapb.docs.person.Person.Address](_l) { + def addressType: _root_.scalapb.lenses.Lens[UpperPB, scalapb.docs.person.Person.AddressType] = + field(_.addressType)((c_, f_) => c_.copy(addressType = f_)) + def street: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = + field(_.street)((c_, f_) => c_.copy(street = f_)) + def city: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = + field(_.city)((c_, f_) => c_.copy(city = f_)) } final val ADDRESS_TYPE_FIELD_NUMBER = 1 - final val STREET_FIELD_NUMBER = 2 - final val CITY_FIELD_NUMBER = 3 + final val STREET_FIELD_NUMBER = 2 + final val CITY_FIELD_NUMBER = 3 def of( - addressType: scalapb.docs.person.Person.AddressType, - street: _root_.scala.Predef.String, - city: _root_.scala.Predef.String + addressType: scalapb.docs.person.Person.AddressType, + street: _root_.scala.Predef.String, + city: _root_.scala.Predef.String ): _root_.scalapb.docs.person.Person.Address = _root_.scalapb.docs.person.Person.Address( addressType, street, @@ -374,19 +459,25 @@ object Person extends scalapb.GeneratedMessageCompanion[scalapb.docs.person.Pers ) // @@protoc_insertion_point(GeneratedMessageCompanion[scalapb.docs.Person.Address]) } - - implicit class PersonLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, scalapb.docs.person.Person]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, scalapb.docs.person.Person](_l) { - def name: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.name)((c_, f_) => c_.copy(name = f_)) - def age: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.age)((c_, f_) => c_.copy(age = f_)) - def addresses: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[scalapb.docs.person.Person.Address]] = field(_.addresses)((c_, f_) => c_.copy(addresses = f_)) + + implicit class PersonLens[UpperPB]( + _l: _root_.scalapb.lenses.Lens[UpperPB, scalapb.docs.person.Person] + ) extends _root_.scalapb.lenses.ObjectLens[UpperPB, scalapb.docs.person.Person](_l) { + def name: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = + field(_.name)((c_, f_) => c_.copy(name = f_)) + def age: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = + field(_.age)((c_, f_) => c_.copy(age = f_)) + def addresses: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[ + scalapb.docs.person.Person.Address + ]] = field(_.addresses)((c_, f_) => c_.copy(addresses = f_)) } - final val NAME_FIELD_NUMBER = 1 - final val AGE_FIELD_NUMBER = 2 + final val NAME_FIELD_NUMBER = 1 + final val AGE_FIELD_NUMBER = 2 final val ADDRESSES_FIELD_NUMBER = 3 def of( - name: _root_.scala.Predef.String, - age: _root_.scala.Int, - addresses: _root_.scala.Seq[scalapb.docs.person.Person.Address] + name: _root_.scala.Predef.String, + age: _root_.scala.Int, + addresses: _root_.scala.Seq[scalapb.docs.person.Person.Address] ): _root_.scalapb.docs.person.Person = _root_.scalapb.docs.person.Person( name, age, diff --git a/docs/src/main/scala/generated/scalapb/docs/person/PersonProto.scala b/docs/src/main/scala/generated/scalapb/docs/person/PersonProto.scala index 2c678384e..830138f65 100644 --- a/docs/src/main/scala/generated/scalapb/docs/person/PersonProto.scala +++ b/docs/src/main/scala/generated/scalapb/docs/person/PersonProto.scala @@ -7,28 +7,40 @@ package scalapb.docs.person object PersonProto extends _root_.scalapb.GeneratedFileObject { lazy val dependencies: Seq[_root_.scalapb.GeneratedFileObject] = Seq.empty - lazy val messagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = + lazy val messagesCompanions + : Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]]( scalapb.docs.person.Person ) private lazy val ProtoBytes: _root_.scala.Array[Byte] = - scalapb.Encoding.fromBase64(scala.collection.immutable.Seq( - """CgxwZXJzb24ucHJvdG8SDHNjYWxhcGIuZG9jcyLvAgoGUGVyc29uEh0KBG5hbWUYASABKAlCCeI/BhIEbmFtZVIEbmFtZRIaC + scalapb.Encoding.fromBase64( + scala.collection.immutable + .Seq( + """CgxwZXJzb24ucHJvdG8SDHNjYWxhcGIuZG9jcyLvAgoGUGVyc29uEh0KBG5hbWUYASABKAlCCeI/BhIEbmFtZVIEbmFtZRIaC gNhZ2UYAiABKAVCCOI/BRIDYWdlUgNhZ2USSgoJYWRkcmVzc2VzGAMgAygLMhwuc2NhbGFwYi5kb2NzLlBlcnNvbi5BZGRyZXNzQ g7iPwsSCWFkZHJlc3Nlc1IJYWRkcmVzc2VzGqQBCgdBZGRyZXNzElUKDGFkZHJlc3NfdHlwZRgBIAEoDjIgLnNjYWxhcGIuZG9jc y5QZXJzb24uQWRkcmVzc1R5cGVCEOI/DRILYWRkcmVzc1R5cGVSC2FkZHJlc3NUeXBlEiMKBnN0cmVldBgCIAEoCUIL4j8IEgZzd HJlZXRSBnN0cmVldBIdCgRjaXR5GAMgASgJQgniPwYSBGNpdHlSBGNpdHkiNwoLQWRkcmVzc1R5cGUSEwoESE9NRRAAGgniPwYSB EhPTUUSEwoEV09SSxABGgniPwYSBFdPUktiBnByb3RvMw==""" - ).mkString) + ) + .mkString + ) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) - _root_.scalapb.descriptors.FileDescriptor.buildFrom(scalaProto, dependencies.map(_.scalaDescriptor)) + _root_.scalapb.descriptors.FileDescriptor + .buildFrom(scalaProto, dependencies.map(_.scalaDescriptor)) } lazy val javaDescriptor: com.google.protobuf.Descriptors.FileDescriptor = { val javaProto = com.google.protobuf.DescriptorProtos.FileDescriptorProto.parseFrom(ProtoBytes) - com.google.protobuf.Descriptors.FileDescriptor.buildFrom(javaProto, _root_.scala.Array( - )) + com.google.protobuf.Descriptors.FileDescriptor.buildFrom( + javaProto, + _root_.scala.Array( + ) + ) } - @deprecated("Use javaDescriptor instead. In a future version this will refer to scalaDescriptor.", "ScalaPB 0.5.47") + @deprecated( + "Use javaDescriptor instead. In a future version this will refer to scalaDescriptor.", + "ScalaPB 0.5.47" + ) def descriptor: com.google.protobuf.Descriptors.FileDescriptor = javaDescriptor -} \ No newline at end of file +} diff --git a/docs/src/main/scala/generated/scalapb/perf/protos/Color.scala b/docs/src/main/scala/generated/scalapb/perf/protos/Color.scala index bd77b5523..4cf9dd8ae 100644 --- a/docs/src/main/scala/generated/scalapb/perf/protos/Color.scala +++ b/docs/src/main/scala/generated/scalapb/perf/protos/Color.scala @@ -6,58 +6,65 @@ package scalapb.perf.protos sealed abstract class Color(val value: _root_.scala.Int) extends _root_.scalapb.GeneratedEnum { - type EnumType = Color + type EnumType = Color type RecognizedType = scalapb.perf.protos.Color.Recognized - def isUnknown: _root_.scala.Boolean = false - def isRed: _root_.scala.Boolean = false - def isGreen: _root_.scala.Boolean = false - def isBlue: _root_.scala.Boolean = false + def isUnknown: _root_.scala.Boolean = false + def isRed: _root_.scala.Boolean = false + def isGreen: _root_.scala.Boolean = false + def isBlue: _root_.scala.Boolean = false def companion: _root_.scalapb.GeneratedEnumCompanion[Color] = scalapb.perf.protos.Color - final def asRecognized: _root_.scala.Option[scalapb.perf.protos.Color.Recognized] = if (isUnrecognized) _root_.scala.None else _root_.scala.Some(this.asInstanceOf[scalapb.perf.protos.Color.Recognized]) + final def asRecognized: _root_.scala.Option[scalapb.perf.protos.Color.Recognized] = if ( + isUnrecognized + ) _root_.scala.None + else _root_.scala.Some(this.asInstanceOf[scalapb.perf.protos.Color.Recognized]) } object Color extends _root_.scalapb.GeneratedEnumCompanion[Color] { sealed trait Recognized extends Color implicit def enumCompanion: _root_.scalapb.GeneratedEnumCompanion[Color] = this - + @SerialVersionUID(0L) case object UNKNOWN extends Color(0) with Color.Recognized { - val index = 0 - val name = "UNKNOWN" + val index = 0 + val name = "UNKNOWN" override def isUnknown: _root_.scala.Boolean = true } - + @SerialVersionUID(0L) case object RED extends Color(1) with Color.Recognized { - val index = 1 - val name = "RED" + val index = 1 + val name = "RED" override def isRed: _root_.scala.Boolean = true } - + @SerialVersionUID(0L) case object GREEN extends Color(2) with Color.Recognized { - val index = 2 - val name = "GREEN" + val index = 2 + val name = "GREEN" override def isGreen: _root_.scala.Boolean = true } - + @SerialVersionUID(0L) case object BLUE extends Color(3) with Color.Recognized { - val index = 3 - val name = "BLUE" + val index = 3 + val name = "BLUE" override def isBlue: _root_.scala.Boolean = true } - + @SerialVersionUID(0L) - final case class Unrecognized(unrecognizedValue: _root_.scala.Int) extends Color(unrecognizedValue) with _root_.scalapb.UnrecognizedEnum + final case class Unrecognized(unrecognizedValue: _root_.scala.Int) + extends Color(unrecognizedValue) + with _root_.scalapb.UnrecognizedEnum lazy val values = scala.collection.immutable.Seq(UNKNOWN, RED, GREEN, BLUE) def fromValue(__value: _root_.scala.Int): Color = __value match { - case 0 => UNKNOWN - case 1 => RED - case 2 => GREEN - case 3 => BLUE + case 0 => UNKNOWN + case 1 => RED + case 2 => GREEN + case 3 => BLUE case __other => Unrecognized(__other) } - def javaDescriptor: _root_.com.google.protobuf.Descriptors.EnumDescriptor = ProtosProto.javaDescriptor.getEnumTypes().get(0) - def scalaDescriptor: _root_.scalapb.descriptors.EnumDescriptor = ProtosProto.scalaDescriptor.enums(0) -} \ No newline at end of file + def javaDescriptor: _root_.com.google.protobuf.Descriptors.EnumDescriptor = + ProtosProto.javaDescriptor.getEnumTypes().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.EnumDescriptor = + ProtosProto.scalaDescriptor.enums(0) +} diff --git a/docs/src/main/scala/generated/scalapb/perf/protos/Enum.scala b/docs/src/main/scala/generated/scalapb/perf/protos/Enum.scala index 5d989bbdf..4403b6c8e 100644 --- a/docs/src/main/scala/generated/scalapb/perf/protos/Enum.scala +++ b/docs/src/main/scala/generated/scalapb/perf/protos/Enum.scala @@ -9,67 +9,73 @@ package scalapb.perf.protos final case class Enum( color: scalapb.perf.protos.Color = scalapb.perf.protos.Color.UNKNOWN, unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty - ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Enum] { - @transient - private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 - private[this] def __computeSerializedSize(): _root_.scala.Int = { - var __size = 0 - - { - val __value = color.value - if (__value != 0) { - __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(1, __value) - } - }; - __size += unknownFields.serializedSize - __size - } - override def serializedSize: _root_.scala.Int = { - var __size = __serializedSizeMemoized - if (__size == 0) { - __size = __computeSerializedSize() + 1 - __serializedSizeMemoized = __size +) extends scalapb.GeneratedMessage + with scalapb.lenses.Updatable[Enum] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = color.value + if (__value != 0) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(1, __value) } - __size - 1 - - } - def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { - { - val __v = color.value - if (__v != 0) { - _output__.writeEnum(1, __v) - } - }; - unknownFields.writeTo(_output__) + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size } - def withColor(__v: scalapb.perf.protos.Color): Enum = copy(color = __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 => { - val __t = color.javaValueDescriptor - if (__t.getNumber() != 0) __t else null - } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = color.value + if (__v != 0) { + _output__.writeEnum(1, __v) } - } - 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.PEnum(color.scalaValueDescriptor) + }; + unknownFields.writeTo(_output__) + } + def withColor(__v: scalapb.perf.protos.Color): Enum = copy(color = __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 => { + val __t = color.javaValueDescriptor + if (__t.getNumber() != 0) __t else null } } - def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) - def companion: scalapb.perf.protos.Enum.type = scalapb.perf.protos.Enum - // @@protoc_insertion_point(GeneratedMessage[scalapb.perf.Enum]) + } + 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.PEnum(color.scalaValueDescriptor) + } + } + def toProtoString: _root_.scala.Predef.String = + _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: scalapb.perf.protos.Enum.type = scalapb.perf.protos.Enum + // @@protoc_insertion_point(GeneratedMessage[scalapb.perf.Enum]) } object Enum extends scalapb.GeneratedMessageCompanion[scalapb.perf.protos.Enum] { implicit def messageCompanion: scalapb.GeneratedMessageCompanion[scalapb.perf.protos.Enum] = this - def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): scalapb.perf.protos.Enum = { + def parseFrom( + `_input__`: _root_.com.google.protobuf.CodedInputStream + ): scalapb.perf.protos.Enum = { var __color: scalapb.perf.protos.Color = scalapb.perf.protos.Color.UNKNOWN - var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null - var _done__ = false + var `_unknownFields__` : _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false while (!_done__) { val _tag__ = _input__.readTag() _tag__ match { @@ -84,36 +90,59 @@ object Enum extends scalapb.GeneratedMessageCompanion[scalapb.perf.protos.Enum] } } scalapb.perf.protos.Enum( - color = __color, - unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + color = __color, + unknownFields = + if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty + else _unknownFields__.result() ) } - implicit def messageReads: _root_.scalapb.descriptors.Reads[scalapb.perf.protos.Enum] = _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.") - scalapb.perf.protos.Enum( - color = scalapb.perf.protos.Color.fromValue(__fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scalapb.descriptors.EnumValueDescriptor]).getOrElse(scalapb.perf.protos.Color.UNKNOWN.scalaValueDescriptor).number) - ) - case _ => throw new RuntimeException("Expected PMessage") - } - def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ProtosProto.javaDescriptor.getMessageTypes().get(2) - def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ProtosProto.scalaDescriptor.messages(2) - 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[_] = { - (__fieldNumber: @_root_.scala.unchecked) match { + implicit def messageReads: _root_.scalapb.descriptors.Reads[scalapb.perf.protos.Enum] = + _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." + ) + scalapb.perf.protos.Enum( + color = scalapb.perf.protos.Color.fromValue( + __fieldsMap + .get(scalaDescriptor.findFieldByNumber(1).get) + .map(_.as[_root_.scalapb.descriptors.EnumValueDescriptor]) + .getOrElse(scalapb.perf.protos.Color.UNKNOWN.scalaValueDescriptor) + .number + ) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = + ProtosProto.javaDescriptor.getMessageTypes().get(2) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = + ProtosProto.scalaDescriptor.messages(2) + 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[_] = { + (__fieldNumber: @ _root_.scala.unchecked) match { case 1 => scalapb.perf.protos.Color } } lazy val defaultInstance = scalapb.perf.protos.Enum( color = scalapb.perf.protos.Color.UNKNOWN ) - implicit class EnumLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, scalapb.perf.protos.Enum]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, scalapb.perf.protos.Enum](_l) { - def color: _root_.scalapb.lenses.Lens[UpperPB, scalapb.perf.protos.Color] = field(_.color)((c_, f_) => c_.copy(color = f_)) + implicit class EnumLens[UpperPB]( + _l: _root_.scalapb.lenses.Lens[UpperPB, scalapb.perf.protos.Enum] + ) extends _root_.scalapb.lenses.ObjectLens[UpperPB, scalapb.perf.protos.Enum](_l) { + def color: _root_.scalapb.lenses.Lens[UpperPB, scalapb.perf.protos.Color] = + field(_.color)((c_, f_) => c_.copy(color = f_)) } final val COLOR_FIELD_NUMBER = 1 def of( - color: scalapb.perf.protos.Color + color: scalapb.perf.protos.Color ): _root_.scalapb.perf.protos.Enum = _root_.scalapb.perf.protos.Enum( color ) diff --git a/docs/src/main/scala/generated/scalapb/perf/protos/EnumVector.scala b/docs/src/main/scala/generated/scalapb/perf/protos/EnumVector.scala index 362e96fd1..ec710ebf5 100644 --- a/docs/src/main/scala/generated/scalapb/perf/protos/EnumVector.scala +++ b/docs/src/main/scala/generated/scalapb/perf/protos/EnumVector.scala @@ -9,72 +9,89 @@ package scalapb.perf.protos final case class EnumVector( colors: _root_.scala.Seq[scalapb.perf.protos.Color] = _root_.scala.Seq.empty, unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty - ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[EnumVector] { - private[this] def colorsSerializedSize = { - if (__colorsSerializedSizeField == 0) __colorsSerializedSizeField = { - var __s: _root_.scala.Int = 0 - colors.foreach(__i => __s += _root_.com.google.protobuf.CodedOutputStream.computeEnumSizeNoTag(__i.value)) - __s - } - __colorsSerializedSizeField - } - @transient private[this] var __colorsSerializedSizeField: _root_.scala.Int = 0 - @transient - private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 - private[this] def __computeSerializedSize(): _root_.scala.Int = { - var __size = 0 - if (colors.nonEmpty) { - val __localsize = colorsSerializedSize - __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__localsize) + __localsize - } - __size += unknownFields.serializedSize - __size +) extends scalapb.GeneratedMessage + with scalapb.lenses.Updatable[EnumVector] { + private[this] def colorsSerializedSize = { + if (__colorsSerializedSizeField == 0) __colorsSerializedSizeField = { + var __s: _root_.scala.Int = 0 + colors.foreach(__i => + __s += _root_.com.google.protobuf.CodedOutputStream.computeEnumSizeNoTag(__i.value) + ) + __s } - override def serializedSize: _root_.scala.Int = { - var __size = __serializedSizeMemoized - if (__size == 0) { - __size = __computeSerializedSize() + 1 - __serializedSizeMemoized = __size - } - __size - 1 - + __colorsSerializedSizeField + } + @transient private[this] var __colorsSerializedSizeField: _root_.scala.Int = 0 + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + if (colors.nonEmpty) { + val __localsize = colorsSerializedSize + __size += 1 + _root_.com.google.protobuf.CodedOutputStream + .computeUInt32SizeNoTag(__localsize) + __localsize } - def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { - if (colors.nonEmpty) { - _output__.writeTag(1, 2) - _output__.writeUInt32NoTag(colorsSerializedSize) - colors.foreach((_output__.writeEnumNoTag _).compose((_: scalapb.perf.protos.Color).value)) - }; - unknownFields.writeTo(_output__) + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size } - def clearColors = copy(colors = _root_.scala.Seq.empty) - def addColors(__vs: scalapb.perf.protos.Color *): EnumVector = addAllColors(__vs) - def addAllColors(__vs: Iterable[scalapb.perf.protos.Color]): EnumVector = copy(colors = colors ++ __vs) - def withColors(__v: _root_.scala.Seq[scalapb.perf.protos.Color]): EnumVector = copy(colors = __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 => colors.iterator.map(_.javaValueDescriptor).toSeq - } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + if (colors.nonEmpty) { + _output__.writeTag(1, 2) + _output__.writeUInt32NoTag(colorsSerializedSize) + colors.foreach((_output__.writeEnumNoTag _).compose((_: scalapb.perf.protos.Color).value)) + }; + unknownFields.writeTo(_output__) + } + def clearColors = copy(colors = _root_.scala.Seq.empty) + def addColors(__vs: scalapb.perf.protos.Color*): EnumVector = addAllColors(__vs) + def addAllColors(__vs: Iterable[scalapb.perf.protos.Color]): EnumVector = + copy(colors = colors ++ __vs) + def withColors(__v: _root_.scala.Seq[scalapb.perf.protos.Color]): EnumVector = copy(colors = __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 => colors.iterator.map(_.javaValueDescriptor).toSeq } - 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(colors.iterator.map(__e => _root_.scalapb.descriptors.PEnum(__e.scalaValueDescriptor)).toVector) - } + } + 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( + colors.iterator + .map(__e => _root_.scalapb.descriptors.PEnum(__e.scalaValueDescriptor)) + .toVector + ) } - def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) - def companion: scalapb.perf.protos.EnumVector.type = scalapb.perf.protos.EnumVector - // @@protoc_insertion_point(GeneratedMessage[scalapb.perf.EnumVector]) + } + def toProtoString: _root_.scala.Predef.String = + _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: scalapb.perf.protos.EnumVector.type = scalapb.perf.protos.EnumVector + // @@protoc_insertion_point(GeneratedMessage[scalapb.perf.EnumVector]) } object EnumVector extends scalapb.GeneratedMessageCompanion[scalapb.perf.protos.EnumVector] { - implicit def messageCompanion: scalapb.GeneratedMessageCompanion[scalapb.perf.protos.EnumVector] = this - def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): scalapb.perf.protos.EnumVector = { - val __colors: _root_.scala.collection.immutable.VectorBuilder[scalapb.perf.protos.Color] = new _root_.scala.collection.immutable.VectorBuilder[scalapb.perf.protos.Color] - var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null - var _done__ = false + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[scalapb.perf.protos.EnumVector] = + this + def parseFrom( + `_input__`: _root_.com.google.protobuf.CodedInputStream + ): scalapb.perf.protos.EnumVector = { + val __colors: _root_.scala.collection.immutable.VectorBuilder[scalapb.perf.protos.Color] = + new _root_.scala.collection.immutable.VectorBuilder[scalapb.perf.protos.Color] + var `_unknownFields__` : _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false while (!_done__) { val _tag__ = _input__.readTag() _tag__ match { @@ -82,7 +99,7 @@ object EnumVector extends scalapb.GeneratedMessageCompanion[scalapb.perf.protos. case 8 => __colors += scalapb.perf.protos.Color.fromValue(_input__.readEnum()) case 10 => { - val length = _input__.readRawVarint32() + val length = _input__.readRawVarint32() val oldLimit = _input__.pushLimit(length) while (_input__.getBytesUntilLimit > 0) { __colors += scalapb.perf.protos.Color.fromValue(_input__.readEnum()) @@ -97,36 +114,59 @@ object EnumVector extends scalapb.GeneratedMessageCompanion[scalapb.perf.protos. } } scalapb.perf.protos.EnumVector( - colors = __colors.result(), - unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + colors = __colors.result(), + unknownFields = + if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty + else _unknownFields__.result() ) } - implicit def messageReads: _root_.scalapb.descriptors.Reads[scalapb.perf.protos.EnumVector] = _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.") - scalapb.perf.protos.EnumVector( - colors = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Seq[_root_.scalapb.descriptors.EnumValueDescriptor]]).getOrElse(_root_.scala.Seq.empty).iterator.map(__e => scalapb.perf.protos.Color.fromValue(__e.number)).toSeq - ) - case _ => throw new RuntimeException("Expected PMessage") - } - def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ProtosProto.javaDescriptor.getMessageTypes().get(3) - def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ProtosProto.scalaDescriptor.messages(3) - 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[_] = { - (__fieldNumber: @_root_.scala.unchecked) match { + implicit def messageReads: _root_.scalapb.descriptors.Reads[scalapb.perf.protos.EnumVector] = + _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." + ) + scalapb.perf.protos.EnumVector( + colors = __fieldsMap + .get(scalaDescriptor.findFieldByNumber(1).get) + .map(_.as[_root_.scala.Seq[_root_.scalapb.descriptors.EnumValueDescriptor]]) + .getOrElse(_root_.scala.Seq.empty) + .iterator + .map(__e => scalapb.perf.protos.Color.fromValue(__e.number)) + .toSeq + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = + ProtosProto.javaDescriptor.getMessageTypes().get(3) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = + ProtosProto.scalaDescriptor.messages(3) + 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[_] = { + (__fieldNumber: @ _root_.scala.unchecked) match { case 1 => scalapb.perf.protos.Color } } lazy val defaultInstance = scalapb.perf.protos.EnumVector( colors = _root_.scala.Seq.empty ) - implicit class EnumVectorLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, scalapb.perf.protos.EnumVector]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, scalapb.perf.protos.EnumVector](_l) { - def colors: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[scalapb.perf.protos.Color]] = field(_.colors)((c_, f_) => c_.copy(colors = f_)) + implicit class EnumVectorLens[UpperPB]( + _l: _root_.scalapb.lenses.Lens[UpperPB, scalapb.perf.protos.EnumVector] + ) extends _root_.scalapb.lenses.ObjectLens[UpperPB, scalapb.perf.protos.EnumVector](_l) { + def colors: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[scalapb.perf.protos.Color]] = + field(_.colors)((c_, f_) => c_.copy(colors = f_)) } final val COLORS_FIELD_NUMBER = 1 def of( - colors: _root_.scala.Seq[scalapb.perf.protos.Color] + colors: _root_.scala.Seq[scalapb.perf.protos.Color] ): _root_.scalapb.perf.protos.EnumVector = _root_.scalapb.perf.protos.EnumVector( colors ) diff --git a/docs/src/main/scala/generated/scalapb/perf/protos/IntVector.scala b/docs/src/main/scala/generated/scalapb/perf/protos/IntVector.scala index fe7b872ce..bb28b5f0d 100644 --- a/docs/src/main/scala/generated/scalapb/perf/protos/IntVector.scala +++ b/docs/src/main/scala/generated/scalapb/perf/protos/IntVector.scala @@ -9,72 +9,86 @@ package scalapb.perf.protos final case class IntVector( ints: _root_.scala.Seq[_root_.scala.Int] = _root_.scala.Seq.empty, unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty - ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[IntVector] { - private[this] def intsSerializedSize = { - if (__intsSerializedSizeField == 0) __intsSerializedSizeField = { - var __s: _root_.scala.Int = 0 - ints.foreach(__i => __s += _root_.com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(__i)) - __s - } - __intsSerializedSizeField - } - @transient private[this] var __intsSerializedSizeField: _root_.scala.Int = 0 - @transient - private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 - private[this] def __computeSerializedSize(): _root_.scala.Int = { - var __size = 0 - if (ints.nonEmpty) { - val __localsize = intsSerializedSize - __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__localsize) + __localsize - } - __size += unknownFields.serializedSize - __size +) extends scalapb.GeneratedMessage + with scalapb.lenses.Updatable[IntVector] { + private[this] def intsSerializedSize = { + if (__intsSerializedSizeField == 0) __intsSerializedSizeField = { + var __s: _root_.scala.Int = 0 + ints.foreach(__i => + __s += _root_.com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(__i) + ) + __s } - override def serializedSize: _root_.scala.Int = { - var __size = __serializedSizeMemoized - if (__size == 0) { - __size = __computeSerializedSize() + 1 - __serializedSizeMemoized = __size - } - __size - 1 - + __intsSerializedSizeField + } + @transient private[this] var __intsSerializedSizeField: _root_.scala.Int = 0 + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + if (ints.nonEmpty) { + val __localsize = intsSerializedSize + __size += 1 + _root_.com.google.protobuf.CodedOutputStream + .computeUInt32SizeNoTag(__localsize) + __localsize } - def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { - if (ints.nonEmpty) { - _output__.writeTag(1, 2) - _output__.writeUInt32NoTag(intsSerializedSize) - ints.foreach(_output__.writeInt32NoTag) - }; - unknownFields.writeTo(_output__) + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size } - def clearInts = copy(ints = _root_.scala.Seq.empty) - def addInts(__vs: _root_.scala.Int *): IntVector = addAllInts(__vs) - def addAllInts(__vs: Iterable[_root_.scala.Int]): IntVector = copy(ints = ints ++ __vs) - def withInts(__v: _root_.scala.Seq[_root_.scala.Int]): IntVector = copy(ints = __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 => ints - } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + if (ints.nonEmpty) { + _output__.writeTag(1, 2) + _output__.writeUInt32NoTag(intsSerializedSize) + ints.foreach(_output__.writeInt32NoTag) + }; + unknownFields.writeTo(_output__) + } + def clearInts = copy(ints = _root_.scala.Seq.empty) + def addInts(__vs: _root_.scala.Int*): IntVector = addAllInts(__vs) + def addAllInts(__vs: Iterable[_root_.scala.Int]): IntVector = copy(ints = ints ++ __vs) + def withInts(__v: _root_.scala.Seq[_root_.scala.Int]): IntVector = copy(ints = __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 => ints } - 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(ints.iterator.map(_root_.scalapb.descriptors.PInt(_)).toVector) - } + } + 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( + ints.iterator.map(_root_.scalapb.descriptors.PInt(_)).toVector + ) } - def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) - def companion: scalapb.perf.protos.IntVector.type = scalapb.perf.protos.IntVector - // @@protoc_insertion_point(GeneratedMessage[scalapb.perf.IntVector]) + } + def toProtoString: _root_.scala.Predef.String = + _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: scalapb.perf.protos.IntVector.type = scalapb.perf.protos.IntVector + // @@protoc_insertion_point(GeneratedMessage[scalapb.perf.IntVector]) } object IntVector extends scalapb.GeneratedMessageCompanion[scalapb.perf.protos.IntVector] { - implicit def messageCompanion: scalapb.GeneratedMessageCompanion[scalapb.perf.protos.IntVector] = this - def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): scalapb.perf.protos.IntVector = { - val __ints: _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Int] = new _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Int] - var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null - var _done__ = false + implicit def messageCompanion: scalapb.GeneratedMessageCompanion[scalapb.perf.protos.IntVector] = + this + def parseFrom( + `_input__`: _root_.com.google.protobuf.CodedInputStream + ): scalapb.perf.protos.IntVector = { + val __ints: _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Int] = + new _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Int] + var `_unknownFields__` : _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false while (!_done__) { val _tag__ = _input__.readTag() _tag__ match { @@ -82,7 +96,7 @@ object IntVector extends scalapb.GeneratedMessageCompanion[scalapb.perf.protos.I case 8 => __ints += _input__.readInt32() case 10 => { - val length = _input__.readRawVarint32() + val length = _input__.readRawVarint32() val oldLimit = _input__.pushLimit(length) while (_input__.getBytesUntilLimit > 0) { __ints += _input__.readInt32() @@ -97,32 +111,52 @@ object IntVector extends scalapb.GeneratedMessageCompanion[scalapb.perf.protos.I } } scalapb.perf.protos.IntVector( - ints = __ints.result(), - unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + ints = __ints.result(), + unknownFields = + if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty + else _unknownFields__.result() ) } - implicit def messageReads: _root_.scalapb.descriptors.Reads[scalapb.perf.protos.IntVector] = _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.") - scalapb.perf.protos.IntVector( - ints = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Seq[_root_.scala.Int]]).getOrElse(_root_.scala.Seq.empty) - ) - case _ => throw new RuntimeException("Expected PMessage") - } - def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ProtosProto.javaDescriptor.getMessageTypes().get(4) - def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ProtosProto.scalaDescriptor.messages(4) - 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) + implicit def messageReads: _root_.scalapb.descriptors.Reads[scalapb.perf.protos.IntVector] = + _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." + ) + scalapb.perf.protos.IntVector( + ints = __fieldsMap + .get(scalaDescriptor.findFieldByNumber(1).get) + .map(_.as[_root_.scala.Seq[_root_.scala.Int]]) + .getOrElse(_root_.scala.Seq.empty) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = + ProtosProto.javaDescriptor.getMessageTypes().get(4) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = + ProtosProto.scalaDescriptor.messages(4) + 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 = scalapb.perf.protos.IntVector( ints = _root_.scala.Seq.empty ) - implicit class IntVectorLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, scalapb.perf.protos.IntVector]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, scalapb.perf.protos.IntVector](_l) { - def ints: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Int]] = field(_.ints)((c_, f_) => c_.copy(ints = f_)) + implicit class IntVectorLens[UpperPB]( + _l: _root_.scalapb.lenses.Lens[UpperPB, scalapb.perf.protos.IntVector] + ) extends _root_.scalapb.lenses.ObjectLens[UpperPB, scalapb.perf.protos.IntVector](_l) { + def ints: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Int]] = + field(_.ints)((c_, f_) => c_.copy(ints = f_)) } final val INTS_FIELD_NUMBER = 1 def of( - ints: _root_.scala.Seq[_root_.scala.Int] + ints: _root_.scala.Seq[_root_.scala.Int] ): _root_.scalapb.perf.protos.IntVector = _root_.scalapb.perf.protos.IntVector( ints ) diff --git a/docs/src/main/scala/generated/scalapb/perf/protos/MessageContainer.scala b/docs/src/main/scala/generated/scalapb/perf/protos/MessageContainer.scala index 6101e6ba0..1e5b5fa0e 100644 --- a/docs/src/main/scala/generated/scalapb/perf/protos/MessageContainer.scala +++ b/docs/src/main/scala/generated/scalapb/perf/protos/MessageContainer.scala @@ -6,95 +6,114 @@ package scalapb.perf.protos /** @param rep - * [(scalapb.field).collection_type="List"]; + * [(scalapb.field).collection_type="List"]; */ @SerialVersionUID(0L) final case class MessageContainer( opt: _root_.scala.Option[scalapb.perf.protos.SimpleMessage] = _root_.scala.None, rep: _root_.scala.Seq[scalapb.perf.protos.SimpleMessage] = _root_.scala.Seq.empty, unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty - ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[MessageContainer] { - @transient - private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 - private[this] def __computeSerializedSize(): _root_.scala.Int = { - var __size = 0 - if (opt.isDefined) { - val __value = opt.get - __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize - }; - rep.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 - +) extends scalapb.GeneratedMessage + with scalapb.lenses.Updatable[MessageContainer] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + if (opt.isDefined) { + val __value = opt.get + __size += 1 + _root_.com.google.protobuf.CodedOutputStream + .computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + rep.foreach { __item => + val __value = __item + __size += 1 + _root_.com.google.protobuf.CodedOutputStream + .computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize } - def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { - opt.foreach { __v => - val __m = __v - _output__.writeTag(1, 2) - _output__.writeUInt32NoTag(__m.serializedSize) - __m.writeTo(_output__) - }; - rep.foreach { __v => - val __m = __v - _output__.writeTag(2, 2) - _output__.writeUInt32NoTag(__m.serializedSize) - __m.writeTo(_output__) - }; - unknownFields.writeTo(_output__) + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size } - def getOpt: scalapb.perf.protos.SimpleMessage = opt.getOrElse(scalapb.perf.protos.SimpleMessage.defaultInstance) - def clearOpt: MessageContainer = copy(opt = _root_.scala.None) - def withOpt(__v: scalapb.perf.protos.SimpleMessage): MessageContainer = copy(opt = Option(__v)) - def clearRep = copy(rep = _root_.scala.Seq.empty) - def addRep(__vs: scalapb.perf.protos.SimpleMessage *): MessageContainer = addAllRep(__vs) - def addAllRep(__vs: Iterable[scalapb.perf.protos.SimpleMessage]): MessageContainer = copy(rep = rep ++ __vs) - def withRep(__v: _root_.scala.Seq[scalapb.perf.protos.SimpleMessage]): MessageContainer = copy(rep = __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 => opt.orNull - case 2 => rep - } + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + opt.foreach { __v => + val __m = __v + _output__.writeTag(1, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + rep.foreach { __v => + val __m = __v + _output__.writeTag(2, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + unknownFields.writeTo(_output__) + } + def getOpt: scalapb.perf.protos.SimpleMessage = + opt.getOrElse(scalapb.perf.protos.SimpleMessage.defaultInstance) + def clearOpt: MessageContainer = copy(opt = _root_.scala.None) + def withOpt(__v: scalapb.perf.protos.SimpleMessage): MessageContainer = copy(opt = Option(__v)) + def clearRep = copy(rep = _root_.scala.Seq.empty) + def addRep(__vs: scalapb.perf.protos.SimpleMessage*): MessageContainer = addAllRep(__vs) + def addAllRep(__vs: Iterable[scalapb.perf.protos.SimpleMessage]): MessageContainer = + copy(rep = rep ++ __vs) + def withRep(__v: _root_.scala.Seq[scalapb.perf.protos.SimpleMessage]): MessageContainer = + copy(rep = __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 => opt.orNull + case 2 => rep } - 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 => opt.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) - case 2 => _root_.scalapb.descriptors.PRepeated(rep.iterator.map(_.toPMessage).toVector) - } + } + 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 => opt.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 2 => _root_.scalapb.descriptors.PRepeated(rep.iterator.map(_.toPMessage).toVector) } - def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) - def companion: scalapb.perf.protos.MessageContainer.type = scalapb.perf.protos.MessageContainer - // @@protoc_insertion_point(GeneratedMessage[scalapb.perf.MessageContainer]) + } + def toProtoString: _root_.scala.Predef.String = + _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: scalapb.perf.protos.MessageContainer.type = scalapb.perf.protos.MessageContainer + // @@protoc_insertion_point(GeneratedMessage[scalapb.perf.MessageContainer]) } -object MessageContainer extends scalapb.GeneratedMessageCompanion[scalapb.perf.protos.MessageContainer] { - implicit def messageCompanion: scalapb.GeneratedMessageCompanion[scalapb.perf.protos.MessageContainer] = this - def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): scalapb.perf.protos.MessageContainer = { +object MessageContainer + extends scalapb.GeneratedMessageCompanion[scalapb.perf.protos.MessageContainer] { + implicit def messageCompanion + : scalapb.GeneratedMessageCompanion[scalapb.perf.protos.MessageContainer] = this + def parseFrom( + `_input__`: _root_.com.google.protobuf.CodedInputStream + ): scalapb.perf.protos.MessageContainer = { var __opt: _root_.scala.Option[scalapb.perf.protos.SimpleMessage] = _root_.scala.None - val __rep: _root_.scala.collection.immutable.VectorBuilder[scalapb.perf.protos.SimpleMessage] = new _root_.scala.collection.immutable.VectorBuilder[scalapb.perf.protos.SimpleMessage] - var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null - var _done__ = false + val __rep: _root_.scala.collection.immutable.VectorBuilder[scalapb.perf.protos.SimpleMessage] = + new _root_.scala.collection.immutable.VectorBuilder[scalapb.perf.protos.SimpleMessage] + var `_unknownFields__` : _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false while (!_done__) { val _tag__ = _input__.readTag() _tag__ match { case 0 => _done__ = true case 10 => - __opt = Option(__opt.fold(_root_.scalapb.LiteParser.readMessage[scalapb.perf.protos.SimpleMessage](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))) + __opt = Option( + __opt.fold( + _root_.scalapb.LiteParser.readMessage[scalapb.perf.protos.SimpleMessage](_input__) + )(_root_.scalapb.LiteParser.readMessage(_input__, _)) + ) case 18 => - __rep += _root_.scalapb.LiteParser.readMessage[scalapb.perf.protos.SimpleMessage](_input__) + __rep += _root_.scalapb.LiteParser + .readMessage[scalapb.perf.protos.SimpleMessage](_input__) case tag => if (_unknownFields__ == null) { _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder() @@ -103,46 +122,73 @@ object MessageContainer extends scalapb.GeneratedMessageCompanion[scalapb.perf.p } } scalapb.perf.protos.MessageContainer( - opt = __opt, - rep = __rep.result(), - unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + opt = __opt, + rep = __rep.result(), + unknownFields = + if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty + else _unknownFields__.result() ) } - implicit def messageReads: _root_.scalapb.descriptors.Reads[scalapb.perf.protos.MessageContainer] = _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.") - scalapb.perf.protos.MessageContainer( - opt = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[scalapb.perf.protos.SimpleMessage]]), - rep = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Seq[scalapb.perf.protos.SimpleMessage]]).getOrElse(_root_.scala.Seq.empty) - ) - case _ => throw new RuntimeException("Expected PMessage") - } - def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ProtosProto.javaDescriptor.getMessageTypes().get(1) - def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ProtosProto.scalaDescriptor.messages(1) - def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = { + implicit def messageReads + : _root_.scalapb.descriptors.Reads[scalapb.perf.protos.MessageContainer] = + _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." + ) + scalapb.perf.protos.MessageContainer( + opt = __fieldsMap + .get(scalaDescriptor.findFieldByNumber(1).get) + .flatMap(_.as[_root_.scala.Option[scalapb.perf.protos.SimpleMessage]]), + rep = __fieldsMap + .get(scalaDescriptor.findFieldByNumber(2).get) + .map(_.as[_root_.scala.Seq[scalapb.perf.protos.SimpleMessage]]) + .getOrElse(_root_.scala.Seq.empty) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = + ProtosProto.javaDescriptor.getMessageTypes().get(1) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = + ProtosProto.scalaDescriptor.messages(1) + def messageCompanionForFieldNumber( + __number: _root_.scala.Int + ): _root_.scalapb.GeneratedMessageCompanion[_] = { var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null - (__number: @_root_.scala.unchecked) match { + (__number: @ _root_.scala.unchecked) match { case 1 => __out = scalapb.perf.protos.SimpleMessage case 2 => __out = scalapb.perf.protos.SimpleMessage } __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 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 = scalapb.perf.protos.MessageContainer( opt = _root_.scala.None, rep = _root_.scala.Seq.empty ) - implicit class MessageContainerLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, scalapb.perf.protos.MessageContainer]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, scalapb.perf.protos.MessageContainer](_l) { - def opt: _root_.scalapb.lenses.Lens[UpperPB, scalapb.perf.protos.SimpleMessage] = field(_.getOpt)((c_, f_) => c_.copy(opt = Option(f_))) - def optionalOpt: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[scalapb.perf.protos.SimpleMessage]] = field(_.opt)((c_, f_) => c_.copy(opt = f_)) - def rep: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[scalapb.perf.protos.SimpleMessage]] = field(_.rep)((c_, f_) => c_.copy(rep = f_)) + implicit class MessageContainerLens[UpperPB]( + _l: _root_.scalapb.lenses.Lens[UpperPB, scalapb.perf.protos.MessageContainer] + ) extends _root_.scalapb.lenses.ObjectLens[UpperPB, scalapb.perf.protos.MessageContainer](_l) { + def opt: _root_.scalapb.lenses.Lens[UpperPB, scalapb.perf.protos.SimpleMessage] = + field(_.getOpt)((c_, f_) => c_.copy(opt = Option(f_))) + def optionalOpt: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[ + scalapb.perf.protos.SimpleMessage + ]] = field(_.opt)((c_, f_) => c_.copy(opt = f_)) + def rep + : _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[scalapb.perf.protos.SimpleMessage]] = + field(_.rep)((c_, f_) => c_.copy(rep = f_)) } final val OPT_FIELD_NUMBER = 1 final val REP_FIELD_NUMBER = 2 def of( - opt: _root_.scala.Option[scalapb.perf.protos.SimpleMessage], - rep: _root_.scala.Seq[scalapb.perf.protos.SimpleMessage] + opt: _root_.scala.Option[scalapb.perf.protos.SimpleMessage], + rep: _root_.scala.Seq[scalapb.perf.protos.SimpleMessage] ): _root_.scalapb.perf.protos.MessageContainer = _root_.scalapb.perf.protos.MessageContainer( opt, rep diff --git a/docs/src/main/scala/generated/scalapb/perf/protos/ProtosProto.scala b/docs/src/main/scala/generated/scalapb/perf/protos/ProtosProto.scala index ee3bd46fb..cbd414173 100644 --- a/docs/src/main/scala/generated/scalapb/perf/protos/ProtosProto.scala +++ b/docs/src/main/scala/generated/scalapb/perf/protos/ProtosProto.scala @@ -9,7 +9,8 @@ object ProtosProto extends _root_.scalapb.GeneratedFileObject { lazy val dependencies: Seq[_root_.scalapb.GeneratedFileObject] = Seq( scalapb.options.ScalapbProto ) - lazy val messagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = + lazy val messagesCompanions + : Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]]( scalapb.perf.protos.SimpleMessage, scalapb.perf.protos.MessageContainer, @@ -19,8 +20,10 @@ object ProtosProto extends _root_.scalapb.GeneratedFileObject { scalapb.perf.protos.StringMessage ) private lazy val ProtoBytes: _root_.scala.Array[Byte] = - scalapb.Encoding.fromBase64(scala.collection.immutable.Seq( - """Cgxwcm90b3MucHJvdG8SDHNjYWxhcGIucGVyZhoVc2NhbGFwYi9zY2FsYXBiLnByb3RvIogBCg1TaW1wbGVNZXNzYWdlEhQKA + scalapb.Encoding.fromBase64( + scala.collection.immutable + .Seq( + """Cgxwcm90b3MucHJvdG8SDHNjYWxhcGIucGVyZhoVc2NhbGFwYi9zY2FsYXBiLnByb3RvIogBCg1TaW1wbGVNZXNzYWdlEhQKA WkYASABKAVCBuI/AxIBaVIBaRIUCgFqGAIgASgFQgbiPwMSAWpSAWoSFAoBaxgDIAEoDEIG4j8DEgFrUgFrEjUKBWNvbG9yGAQgA SgOMhMuc2NhbGFwYi5wZXJmLkNvbG9yQgriPwcSBWNvbG9yUgVjb2xvciKEAQoQTWVzc2FnZUNvbnRhaW5lchI3CgNvcHQYASABK AsyGy5zY2FsYXBiLnBlcmYuU2ltcGxlTWVzc2FnZUII4j8FEgNvcHRSA29wdBI3CgNyZXAYAiADKAsyGy5zY2FsYXBiLnBlcmYuU @@ -44,17 +47,26 @@ object ProtosProto extends _root_.scalapb.GeneratedFileObject { AESAyYIEQoLCgQEBAIAEgMnAhoKDAoFBAQCAAQSAycCCgoMCgUEBAIABRIDJwsQCgwKBQQEAgABEgMnERUKDAoFBAQCAAMSAycYG QoKCgIEBRIEKgAtAQoKCgMEBQESAyoIFQoLCgQEBQIAEgMrAhIKDAoFBAUCAAUSAysCCAoMCgUEBQIAARIDKwkNCgwKBQQFAgADE gMrEBEKCwoEBAUCARIDLAISCgwKBQQFAgEFEgMsAggKDAoFBAUCAQESAywJDQoMCgUEBQIBAxIDLBARYgZwcm90bzM=""" - ).mkString) + ) + .mkString + ) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) - _root_.scalapb.descriptors.FileDescriptor.buildFrom(scalaProto, dependencies.map(_.scalaDescriptor)) + _root_.scalapb.descriptors.FileDescriptor + .buildFrom(scalaProto, dependencies.map(_.scalaDescriptor)) } lazy val javaDescriptor: com.google.protobuf.Descriptors.FileDescriptor = { val javaProto = com.google.protobuf.DescriptorProtos.FileDescriptorProto.parseFrom(ProtoBytes) - com.google.protobuf.Descriptors.FileDescriptor.buildFrom(javaProto, _root_.scala.Array( - scalapb.options.ScalapbProto.javaDescriptor - )) + com.google.protobuf.Descriptors.FileDescriptor.buildFrom( + javaProto, + _root_.scala.Array( + scalapb.options.ScalapbProto.javaDescriptor + ) + ) } - @deprecated("Use javaDescriptor instead. In a future version this will refer to scalaDescriptor.", "ScalaPB 0.5.47") + @deprecated( + "Use javaDescriptor instead. In a future version this will refer to scalaDescriptor.", + "ScalaPB 0.5.47" + ) def descriptor: com.google.protobuf.Descriptors.FileDescriptor = javaDescriptor -} \ No newline at end of file +} diff --git a/docs/src/main/scala/generated/scalapb/perf/protos/SimpleMessage.scala b/docs/src/main/scala/generated/scalapb/perf/protos/SimpleMessage.scala index 369200a81..29245e623 100644 --- a/docs/src/main/scala/generated/scalapb/perf/protos/SimpleMessage.scala +++ b/docs/src/main/scala/generated/scalapb/perf/protos/SimpleMessage.scala @@ -12,127 +12,134 @@ final case class SimpleMessage( k: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY, color: scalapb.perf.protos.Color = scalapb.perf.protos.Color.UNKNOWN, unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty - ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[SimpleMessage] { - @transient - private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 - private[this] def __computeSerializedSize(): _root_.scala.Int = { - var __size = 0 - - { - val __value = i - if (__value != 0) { - __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(1, __value) - } - }; - - { - val __value = j - if (__value != 0) { - __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(2, __value) - } - }; - - { - val __value = k - if (!__value.isEmpty) { - __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(3, __value) - } - }; - - { - val __value = color.value - if (__value != 0) { - __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(4, __value) - } - }; - __size += unknownFields.serializedSize - __size - } - override def serializedSize: _root_.scala.Int = { - var __size = __serializedSizeMemoized - if (__size == 0) { - __size = __computeSerializedSize() + 1 - __serializedSizeMemoized = __size +) extends scalapb.GeneratedMessage + with scalapb.lenses.Updatable[SimpleMessage] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = i + if (__value != 0) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(1, __value) } - __size - 1 - - } - def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { - { - val __v = i - if (__v != 0) { - _output__.writeInt32(1, __v) - } - }; - { - val __v = j - if (__v != 0) { - _output__.writeInt32(2, __v) - } - }; - { - val __v = k - if (!__v.isEmpty) { - _output__.writeBytes(3, __v) - } - }; - { - val __v = color.value - if (__v != 0) { - _output__.writeEnum(4, __v) - } - }; - unknownFields.writeTo(_output__) - } - def withI(__v: _root_.scala.Int): SimpleMessage = copy(i = __v) - def withJ(__v: _root_.scala.Int): SimpleMessage = copy(j = __v) - def withK(__v: _root_.com.google.protobuf.ByteString): SimpleMessage = copy(k = __v) - def withColor(__v: scalapb.perf.protos.Color): SimpleMessage = copy(color = __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 => { - val __t = i - if (__t != 0) __t else null - } - case 2 => { - val __t = j - if (__t != 0) __t else null - } - case 3 => { - val __t = k - if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null - } - case 4 => { - val __t = color.javaValueDescriptor - if (__t.getNumber() != 0) __t else null - } + }; + + { + val __value = j + if (__value != 0) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(2, __value) + } + }; + + { + val __value = k + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(3, __value) } + }; + + { + val __value = color.value + if (__value != 0) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(4, __value) + } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size } - 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.PInt(i) - case 2 => _root_.scalapb.descriptors.PInt(j) - case 3 => _root_.scalapb.descriptors.PByteString(k) - case 4 => _root_.scalapb.descriptors.PEnum(color.scalaValueDescriptor) + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = i + if (__v != 0) { + _output__.writeInt32(1, __v) + } + }; + { + val __v = j + if (__v != 0) { + _output__.writeInt32(2, __v) } + }; + { + val __v = k + if (!__v.isEmpty) { + _output__.writeBytes(3, __v) + } + }; + { + val __v = color.value + if (__v != 0) { + _output__.writeEnum(4, __v) + } + }; + unknownFields.writeTo(_output__) + } + def withI(__v: _root_.scala.Int): SimpleMessage = copy(i = __v) + def withJ(__v: _root_.scala.Int): SimpleMessage = copy(j = __v) + def withK(__v: _root_.com.google.protobuf.ByteString): SimpleMessage = copy(k = __v) + def withColor(__v: scalapb.perf.protos.Color): SimpleMessage = copy(color = __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 => { + val __t = i + if (__t != 0) __t else null + } + case 2 => { + val __t = j + if (__t != 0) __t else null + } + case 3 => { + val __t = k + if (__t != _root_.com.google.protobuf.ByteString.EMPTY) __t else null + } + case 4 => { + val __t = color.javaValueDescriptor + if (__t.getNumber() != 0) __t else null + } + } + } + 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.PInt(i) + case 2 => _root_.scalapb.descriptors.PInt(j) + case 3 => _root_.scalapb.descriptors.PByteString(k) + case 4 => _root_.scalapb.descriptors.PEnum(color.scalaValueDescriptor) } - def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) - def companion: scalapb.perf.protos.SimpleMessage.type = scalapb.perf.protos.SimpleMessage - // @@protoc_insertion_point(GeneratedMessage[scalapb.perf.SimpleMessage]) + } + def toProtoString: _root_.scala.Predef.String = + _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: scalapb.perf.protos.SimpleMessage.type = scalapb.perf.protos.SimpleMessage + // @@protoc_insertion_point(GeneratedMessage[scalapb.perf.SimpleMessage]) } object SimpleMessage extends scalapb.GeneratedMessageCompanion[scalapb.perf.protos.SimpleMessage] { - implicit def messageCompanion: scalapb.GeneratedMessageCompanion[scalapb.perf.protos.SimpleMessage] = this - def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): scalapb.perf.protos.SimpleMessage = { - var __i: _root_.scala.Int = 0 - var __j: _root_.scala.Int = 0 + implicit def messageCompanion + : scalapb.GeneratedMessageCompanion[scalapb.perf.protos.SimpleMessage] = this + def parseFrom( + `_input__`: _root_.com.google.protobuf.CodedInputStream + ): scalapb.perf.protos.SimpleMessage = { + var __i: _root_.scala.Int = 0 + var __j: _root_.scala.Int = 0 var __k: _root_.com.google.protobuf.ByteString = _root_.com.google.protobuf.ByteString.EMPTY - var __color: scalapb.perf.protos.Color = scalapb.perf.protos.Color.UNKNOWN - var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null - var _done__ = false + var __color: scalapb.perf.protos.Color = scalapb.perf.protos.Color.UNKNOWN + var `_unknownFields__` : _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false while (!_done__) { val _tag__ = _input__.readTag() _tag__ match { @@ -153,30 +160,59 @@ object SimpleMessage extends scalapb.GeneratedMessageCompanion[scalapb.perf.prot } } scalapb.perf.protos.SimpleMessage( - i = __i, - j = __j, - k = __k, - color = __color, - unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + i = __i, + j = __j, + k = __k, + color = __color, + unknownFields = + if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty + else _unknownFields__.result() ) } - implicit def messageReads: _root_.scalapb.descriptors.Reads[scalapb.perf.protos.SimpleMessage] = _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.") - scalapb.perf.protos.SimpleMessage( - i = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Int]).getOrElse(0), - j = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Int]).getOrElse(0), - k = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.com.google.protobuf.ByteString]).getOrElse(_root_.com.google.protobuf.ByteString.EMPTY), - color = scalapb.perf.protos.Color.fromValue(__fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scalapb.descriptors.EnumValueDescriptor]).getOrElse(scalapb.perf.protos.Color.UNKNOWN.scalaValueDescriptor).number) - ) - case _ => throw new RuntimeException("Expected PMessage") - } - def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ProtosProto.javaDescriptor.getMessageTypes().get(0) - def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ProtosProto.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[_] = { - (__fieldNumber: @_root_.scala.unchecked) match { + implicit def messageReads: _root_.scalapb.descriptors.Reads[scalapb.perf.protos.SimpleMessage] = + _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." + ) + scalapb.perf.protos.SimpleMessage( + i = __fieldsMap + .get(scalaDescriptor.findFieldByNumber(1).get) + .map(_.as[_root_.scala.Int]) + .getOrElse(0), + j = __fieldsMap + .get(scalaDescriptor.findFieldByNumber(2).get) + .map(_.as[_root_.scala.Int]) + .getOrElse(0), + k = __fieldsMap + .get(scalaDescriptor.findFieldByNumber(3).get) + .map(_.as[_root_.com.google.protobuf.ByteString]) + .getOrElse(_root_.com.google.protobuf.ByteString.EMPTY), + color = scalapb.perf.protos.Color.fromValue( + __fieldsMap + .get(scalaDescriptor.findFieldByNumber(4).get) + .map(_.as[_root_.scalapb.descriptors.EnumValueDescriptor]) + .getOrElse(scalapb.perf.protos.Color.UNKNOWN.scalaValueDescriptor) + .number + ) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = + ProtosProto.javaDescriptor.getMessageTypes().get(0) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = + ProtosProto.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[_] = { + (__fieldNumber: @ _root_.scala.unchecked) match { case 4 => scalapb.perf.protos.Color } } @@ -186,21 +222,27 @@ object SimpleMessage extends scalapb.GeneratedMessageCompanion[scalapb.perf.prot k = _root_.com.google.protobuf.ByteString.EMPTY, color = scalapb.perf.protos.Color.UNKNOWN ) - implicit class SimpleMessageLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, scalapb.perf.protos.SimpleMessage]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, scalapb.perf.protos.SimpleMessage](_l) { - def i: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.i)((c_, f_) => c_.copy(i = f_)) - def j: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.j)((c_, f_) => c_.copy(j = f_)) - def k: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.k)((c_, f_) => c_.copy(k = f_)) - def color: _root_.scalapb.lenses.Lens[UpperPB, scalapb.perf.protos.Color] = field(_.color)((c_, f_) => c_.copy(color = f_)) + implicit class SimpleMessageLens[UpperPB]( + _l: _root_.scalapb.lenses.Lens[UpperPB, scalapb.perf.protos.SimpleMessage] + ) extends _root_.scalapb.lenses.ObjectLens[UpperPB, scalapb.perf.protos.SimpleMessage](_l) { + def i: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = + field(_.i)((c_, f_) => c_.copy(i = f_)) + def j: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = + field(_.j)((c_, f_) => c_.copy(j = f_)) + def k: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = + field(_.k)((c_, f_) => c_.copy(k = f_)) + def color: _root_.scalapb.lenses.Lens[UpperPB, scalapb.perf.protos.Color] = + field(_.color)((c_, f_) => c_.copy(color = f_)) } - final val I_FIELD_NUMBER = 1 - final val J_FIELD_NUMBER = 2 - final val K_FIELD_NUMBER = 3 + final val I_FIELD_NUMBER = 1 + final val J_FIELD_NUMBER = 2 + final val K_FIELD_NUMBER = 3 final val COLOR_FIELD_NUMBER = 4 def of( - i: _root_.scala.Int, - j: _root_.scala.Int, - k: _root_.com.google.protobuf.ByteString, - color: scalapb.perf.protos.Color + i: _root_.scala.Int, + j: _root_.scala.Int, + k: _root_.com.google.protobuf.ByteString, + color: scalapb.perf.protos.Color ): _root_.scalapb.perf.protos.SimpleMessage = _root_.scalapb.perf.protos.SimpleMessage( i, j, diff --git a/docs/src/main/scala/generated/scalapb/perf/protos/StringMessage.scala b/docs/src/main/scala/generated/scalapb/perf/protos/StringMessage.scala index 1c88e2633..cde53ecf9 100644 --- a/docs/src/main/scala/generated/scalapb/perf/protos/StringMessage.scala +++ b/docs/src/main/scala/generated/scalapb/perf/protos/StringMessage.scala @@ -10,87 +10,94 @@ final case class StringMessage( str1: _root_.scala.Predef.String = "", str2: _root_.scala.Predef.String = "", unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty - ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[StringMessage] { - @transient - private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 - private[this] def __computeSerializedSize(): _root_.scala.Int = { - var __size = 0 - - { - val __value = str1 - if (!__value.isEmpty) { - __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) - } - }; - - { - val __value = str2 - if (!__value.isEmpty) { - __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) - } - }; - __size += unknownFields.serializedSize - __size - } - override def serializedSize: _root_.scala.Int = { - var __size = __serializedSizeMemoized - if (__size == 0) { - __size = __computeSerializedSize() + 1 - __serializedSizeMemoized = __size +) extends scalapb.GeneratedMessage + with scalapb.lenses.Updatable[StringMessage] { + @transient + private[this] var __serializedSizeMemoized: _root_.scala.Int = 0 + private[this] def __computeSerializedSize(): _root_.scala.Int = { + var __size = 0 + + { + val __value = str1 + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value) } - __size - 1 - - } - def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { - { - val __v = str1 - if (!__v.isEmpty) { - _output__.writeString(1, __v) - } - }; - { - val __v = str2 - if (!__v.isEmpty) { - _output__.writeString(2, __v) - } - }; - unknownFields.writeTo(_output__) - } - def withStr1(__v: _root_.scala.Predef.String): StringMessage = copy(str1 = __v) - def withStr2(__v: _root_.scala.Predef.String): StringMessage = copy(str2 = __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 => { - val __t = str1 - if (__t != "") __t else null - } - case 2 => { - val __t = str2 - if (__t != "") __t else null - } + }; + + { + val __value = str2 + if (!__value.isEmpty) { + __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value) } + }; + __size += unknownFields.serializedSize + __size + } + override def serializedSize: _root_.scala.Int = { + var __size = __serializedSizeMemoized + if (__size == 0) { + __size = __computeSerializedSize() + 1 + __serializedSizeMemoized = __size } - 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.PString(str1) - case 2 => _root_.scalapb.descriptors.PString(str2) + __size - 1 + + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = { + { + val __v = str1 + if (!__v.isEmpty) { + _output__.writeString(1, __v) + } + }; + { + val __v = str2 + if (!__v.isEmpty) { + _output__.writeString(2, __v) } + }; + unknownFields.writeTo(_output__) + } + def withStr1(__v: _root_.scala.Predef.String): StringMessage = copy(str1 = __v) + def withStr2(__v: _root_.scala.Predef.String): StringMessage = copy(str2 = __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 => { + val __t = str1 + if (__t != "") __t else null + } + case 2 => { + val __t = str2 + if (__t != "") __t else null + } + } + } + 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.PString(str1) + case 2 => _root_.scalapb.descriptors.PString(str2) } - def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this) - def companion: scalapb.perf.protos.StringMessage.type = scalapb.perf.protos.StringMessage - // @@protoc_insertion_point(GeneratedMessage[scalapb.perf.StringMessage]) + } + def toProtoString: _root_.scala.Predef.String = + _root_.scalapb.TextFormat.printToUnicodeString(this) + def companion: scalapb.perf.protos.StringMessage.type = scalapb.perf.protos.StringMessage + // @@protoc_insertion_point(GeneratedMessage[scalapb.perf.StringMessage]) } object StringMessage extends scalapb.GeneratedMessageCompanion[scalapb.perf.protos.StringMessage] { - implicit def messageCompanion: scalapb.GeneratedMessageCompanion[scalapb.perf.protos.StringMessage] = this - def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): scalapb.perf.protos.StringMessage = { - var __str1: _root_.scala.Predef.String = "" - var __str2: _root_.scala.Predef.String = "" - var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null - var _done__ = false + implicit def messageCompanion + : scalapb.GeneratedMessageCompanion[scalapb.perf.protos.StringMessage] = this + def parseFrom( + `_input__`: _root_.com.google.protobuf.CodedInputStream + ): scalapb.perf.protos.StringMessage = { + var __str1: _root_.scala.Predef.String = "" + var __str2: _root_.scala.Predef.String = "" + var `_unknownFields__` : _root_.scalapb.UnknownFieldSet.Builder = null + var _done__ = false while (!_done__) { val _tag__ = _input__.readTag() _tag__ match { @@ -107,38 +114,62 @@ object StringMessage extends scalapb.GeneratedMessageCompanion[scalapb.perf.prot } } scalapb.perf.protos.StringMessage( - str1 = __str1, - str2 = __str2, - unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result() + str1 = __str1, + str2 = __str2, + unknownFields = + if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty + else _unknownFields__.result() ) } - implicit def messageReads: _root_.scalapb.descriptors.Reads[scalapb.perf.protos.StringMessage] = _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.") - scalapb.perf.protos.StringMessage( - str1 = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""), - str2 = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse("") - ) - case _ => throw new RuntimeException("Expected PMessage") - } - def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ProtosProto.javaDescriptor.getMessageTypes().get(5) - def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ProtosProto.scalaDescriptor.messages(5) - 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) + implicit def messageReads: _root_.scalapb.descriptors.Reads[scalapb.perf.protos.StringMessage] = + _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." + ) + scalapb.perf.protos.StringMessage( + str1 = __fieldsMap + .get(scalaDescriptor.findFieldByNumber(1).get) + .map(_.as[_root_.scala.Predef.String]) + .getOrElse(""), + str2 = __fieldsMap + .get(scalaDescriptor.findFieldByNumber(2).get) + .map(_.as[_root_.scala.Predef.String]) + .getOrElse("") + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = + ProtosProto.javaDescriptor.getMessageTypes().get(5) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = + ProtosProto.scalaDescriptor.messages(5) + 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 = scalapb.perf.protos.StringMessage( str1 = "", str2 = "" ) - implicit class StringMessageLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, scalapb.perf.protos.StringMessage]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, scalapb.perf.protos.StringMessage](_l) { - def str1: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.str1)((c_, f_) => c_.copy(str1 = f_)) - def str2: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.str2)((c_, f_) => c_.copy(str2 = f_)) + implicit class StringMessageLens[UpperPB]( + _l: _root_.scalapb.lenses.Lens[UpperPB, scalapb.perf.protos.StringMessage] + ) extends _root_.scalapb.lenses.ObjectLens[UpperPB, scalapb.perf.protos.StringMessage](_l) { + def str1: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = + field(_.str1)((c_, f_) => c_.copy(str1 = f_)) + def str2: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = + field(_.str2)((c_, f_) => c_.copy(str2 = f_)) } final val STR1_FIELD_NUMBER = 1 final val STR2_FIELD_NUMBER = 2 def of( - str1: _root_.scala.Predef.String, - str2: _root_.scala.Predef.String + str1: _root_.scala.Predef.String, + str2: _root_.scala.Predef.String ): _root_.scalapb.perf.protos.StringMessage = _root_.scalapb.perf.protos.StringMessage( str1, str2 diff --git a/e2e-grpc/src/test/scala/MethodDescriptorSpec.scala b/e2e-grpc/src/test/scala/MethodDescriptorSpec.scala index 376e16b7f..2783e87bf 100644 --- a/e2e-grpc/src/test/scala/MethodDescriptorSpec.scala +++ b/e2e-grpc/src/test/scala/MethodDescriptorSpec.scala @@ -7,7 +7,8 @@ import org.scalatest.{LoneElement, OptionValues} class MethodDescriptorSpec extends AnyFlatSpec with Matchers with LoneElement with OptionValues { "scala descriptor" must "expose correct input and output message descriptors" in { - val unaryMethod = Service1Grpc.Service1.scalaDescriptor.methods.find(_.name == "CustomUnary").get + val unaryMethod = + Service1Grpc.Service1.scalaDescriptor.methods.find(_.name == "CustomUnary").get unaryMethod.inputType must be theSameInstanceAs XYMessage.scalaDescriptor unaryMethod.outputType must be theSameInstanceAs Res5.scalaDescriptor