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

io.opentelemetry.proto.common.v1.AnyValue.scala Maven / Gradle / Ivy

There is a newer version: 1.23.0-dev-f04150-1
Show newest version
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3

package io.opentelemetry.proto.common.v1

/** AnyValue is used to represent any type of attribute value. AnyValue may contain a
  * primitive value such as a string or integer or it may contain an arbitrary nested
  * object containing arrays, key-value lists and primitives.
  */
@SerialVersionUID(0L)
final case class AnyValue(
    value: io.opentelemetry.proto.common.v1.AnyValue.Value = io.opentelemetry.proto.common.v1.AnyValue.Value.Empty,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[AnyValue] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      if (value.stringValue.isDefined) {
        val __value = value.stringValue.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value)
      };
      if (value.boolValue.isDefined) {
        val __value = value.boolValue.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(2, __value)
      };
      if (value.intValue.isDefined) {
        val __value = value.intValue.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeInt64Size(3, __value)
      };
      if (value.doubleValue.isDefined) {
        val __value = value.doubleValue.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeDoubleSize(4, __value)
      };
      if (value.arrayValue.isDefined) {
        val __value = value.arrayValue.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (value.kvlistValue.isDefined) {
        val __value = value.kvlistValue.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (value.bytesValue.isDefined) {
        val __value = value.bytesValue.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(7, __value)
      };
      __size += unknownFields.serializedSize
      __size
    }
    override def serializedSize: _root_.scala.Int = {
      var __size = __serializedSizeMemoized
      if (__size == 0) {
        __size = __computeSerializedSize() + 1
        __serializedSizeMemoized = __size
      }
      __size - 1
      
    }
    def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
      value.stringValue.foreach { __v =>
        val __m = __v
        _output__.writeString(1, __m)
      };
      value.boolValue.foreach { __v =>
        val __m = __v
        _output__.writeBool(2, __m)
      };
      value.intValue.foreach { __v =>
        val __m = __v
        _output__.writeInt64(3, __m)
      };
      value.doubleValue.foreach { __v =>
        val __m = __v
        _output__.writeDouble(4, __m)
      };
      value.arrayValue.foreach { __v =>
        val __m = __v
        _output__.writeTag(5, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      value.kvlistValue.foreach { __v =>
        val __m = __v
        _output__.writeTag(6, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      value.bytesValue.foreach { __v =>
        val __m = __v
        _output__.writeBytes(7, __m)
      };
      unknownFields.writeTo(_output__)
    }
    def getStringValue: _root_.scala.Predef.String = value.stringValue.getOrElse("")
    def withStringValue(__v: _root_.scala.Predef.String): AnyValue = copy(value = io.opentelemetry.proto.common.v1.AnyValue.Value.StringValue(__v))
    def getBoolValue: _root_.scala.Boolean = value.boolValue.getOrElse(false)
    def withBoolValue(__v: _root_.scala.Boolean): AnyValue = copy(value = io.opentelemetry.proto.common.v1.AnyValue.Value.BoolValue(__v))
    def getIntValue: _root_.scala.Long = value.intValue.getOrElse(0L)
    def withIntValue(__v: _root_.scala.Long): AnyValue = copy(value = io.opentelemetry.proto.common.v1.AnyValue.Value.IntValue(__v))
    def getDoubleValue: _root_.scala.Double = value.doubleValue.getOrElse(0.0)
    def withDoubleValue(__v: _root_.scala.Double): AnyValue = copy(value = io.opentelemetry.proto.common.v1.AnyValue.Value.DoubleValue(__v))
    def getArrayValue: io.opentelemetry.proto.common.v1.ArrayValue = value.arrayValue.getOrElse(io.opentelemetry.proto.common.v1.ArrayValue.defaultInstance)
    def withArrayValue(__v: io.opentelemetry.proto.common.v1.ArrayValue): AnyValue = copy(value = io.opentelemetry.proto.common.v1.AnyValue.Value.ArrayValue(__v))
    def getKvlistValue: io.opentelemetry.proto.common.v1.KeyValueList = value.kvlistValue.getOrElse(io.opentelemetry.proto.common.v1.KeyValueList.defaultInstance)
    def withKvlistValue(__v: io.opentelemetry.proto.common.v1.KeyValueList): AnyValue = copy(value = io.opentelemetry.proto.common.v1.AnyValue.Value.KvlistValue(__v))
    def getBytesValue: _root_.com.google.protobuf.ByteString = value.bytesValue.getOrElse(_root_.com.google.protobuf.ByteString.EMPTY)
    def withBytesValue(__v: _root_.com.google.protobuf.ByteString): AnyValue = copy(value = io.opentelemetry.proto.common.v1.AnyValue.Value.BytesValue(__v))
    def clearValue: AnyValue = copy(value = io.opentelemetry.proto.common.v1.AnyValue.Value.Empty)
    def withValue(__v: io.opentelemetry.proto.common.v1.AnyValue.Value): AnyValue = copy(value = __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 => value.stringValue.orNull
        case 2 => value.boolValue.orNull
        case 3 => value.intValue.orNull
        case 4 => value.doubleValue.orNull
        case 5 => value.arrayValue.orNull
        case 6 => value.kvlistValue.orNull
        case 7 => value.bytesValue.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 => value.stringValue.map(_root_.scalapb.descriptors.PString(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 2 => value.boolValue.map(_root_.scalapb.descriptors.PBoolean(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 3 => value.intValue.map(_root_.scalapb.descriptors.PLong(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 4 => value.doubleValue.map(_root_.scalapb.descriptors.PDouble(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 5 => value.arrayValue.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 6 => value.kvlistValue.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 7 => value.bytesValue.map(_root_.scalapb.descriptors.PByteString(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: io.opentelemetry.proto.common.v1.AnyValue.type = io.opentelemetry.proto.common.v1.AnyValue
    // @@protoc_insertion_point(GeneratedMessage[opentelemetry.proto.common.v1.AnyValue])
}

object AnyValue extends scalapb.GeneratedMessageCompanion[io.opentelemetry.proto.common.v1.AnyValue] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[io.opentelemetry.proto.common.v1.AnyValue] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): io.opentelemetry.proto.common.v1.AnyValue = {
    var __value: io.opentelemetry.proto.common.v1.AnyValue.Value = io.opentelemetry.proto.common.v1.AnyValue.Value.Empty
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 10 =>
          __value = io.opentelemetry.proto.common.v1.AnyValue.Value.StringValue(_input__.readStringRequireUtf8())
        case 16 =>
          __value = io.opentelemetry.proto.common.v1.AnyValue.Value.BoolValue(_input__.readBool())
        case 24 =>
          __value = io.opentelemetry.proto.common.v1.AnyValue.Value.IntValue(_input__.readInt64())
        case 33 =>
          __value = io.opentelemetry.proto.common.v1.AnyValue.Value.DoubleValue(_input__.readDouble())
        case 42 =>
          __value = io.opentelemetry.proto.common.v1.AnyValue.Value.ArrayValue(__value.arrayValue.fold(_root_.scalapb.LiteParser.readMessage[io.opentelemetry.proto.common.v1.ArrayValue](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 50 =>
          __value = io.opentelemetry.proto.common.v1.AnyValue.Value.KvlistValue(__value.kvlistValue.fold(_root_.scalapb.LiteParser.readMessage[io.opentelemetry.proto.common.v1.KeyValueList](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 58 =>
          __value = io.opentelemetry.proto.common.v1.AnyValue.Value.BytesValue(_input__.readBytes())
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    io.opentelemetry.proto.common.v1.AnyValue(
        value = __value,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[io.opentelemetry.proto.common.v1.AnyValue] = _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.")
      io.opentelemetry.proto.common.v1.AnyValue(
        value = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Predef.String]]).map(io.opentelemetry.proto.common.v1.AnyValue.Value.StringValue(_))
            .orElse[io.opentelemetry.proto.common.v1.AnyValue.Value](__fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Boolean]]).map(io.opentelemetry.proto.common.v1.AnyValue.Value.BoolValue(_)))
            .orElse[io.opentelemetry.proto.common.v1.AnyValue.Value](__fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Long]]).map(io.opentelemetry.proto.common.v1.AnyValue.Value.IntValue(_)))
            .orElse[io.opentelemetry.proto.common.v1.AnyValue.Value](__fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Double]]).map(io.opentelemetry.proto.common.v1.AnyValue.Value.DoubleValue(_)))
            .orElse[io.opentelemetry.proto.common.v1.AnyValue.Value](__fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).flatMap(_.as[_root_.scala.Option[io.opentelemetry.proto.common.v1.ArrayValue]]).map(io.opentelemetry.proto.common.v1.AnyValue.Value.ArrayValue(_)))
            .orElse[io.opentelemetry.proto.common.v1.AnyValue.Value](__fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).flatMap(_.as[_root_.scala.Option[io.opentelemetry.proto.common.v1.KeyValueList]]).map(io.opentelemetry.proto.common.v1.AnyValue.Value.KvlistValue(_)))
            .orElse[io.opentelemetry.proto.common.v1.AnyValue.Value](__fieldsMap.get(scalaDescriptor.findFieldByNumber(7).get).flatMap(_.as[_root_.scala.Option[_root_.com.google.protobuf.ByteString]]).map(io.opentelemetry.proto.common.v1.AnyValue.Value.BytesValue(_)))
            .getOrElse(io.opentelemetry.proto.common.v1.AnyValue.Value.Empty)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = CommonProto.javaDescriptor.getMessageTypes().get(0)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = CommonProto.scalaDescriptor.messages(0)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 5 => __out = io.opentelemetry.proto.common.v1.ArrayValue
      case 6 => __out = io.opentelemetry.proto.common.v1.KeyValueList
    }
    __out
  }
  lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
  lazy val defaultInstance = io.opentelemetry.proto.common.v1.AnyValue(
    value = io.opentelemetry.proto.common.v1.AnyValue.Value.Empty
  )
  sealed trait Value extends _root_.scalapb.GeneratedOneof {
    def isEmpty: _root_.scala.Boolean = false
    def isDefined: _root_.scala.Boolean = true
    def isStringValue: _root_.scala.Boolean = false
    def isBoolValue: _root_.scala.Boolean = false
    def isIntValue: _root_.scala.Boolean = false
    def isDoubleValue: _root_.scala.Boolean = false
    def isArrayValue: _root_.scala.Boolean = false
    def isKvlistValue: _root_.scala.Boolean = false
    def isBytesValue: _root_.scala.Boolean = false
    def stringValue: _root_.scala.Option[_root_.scala.Predef.String] = _root_.scala.None
    def boolValue: _root_.scala.Option[_root_.scala.Boolean] = _root_.scala.None
    def intValue: _root_.scala.Option[_root_.scala.Long] = _root_.scala.None
    def doubleValue: _root_.scala.Option[_root_.scala.Double] = _root_.scala.None
    def arrayValue: _root_.scala.Option[io.opentelemetry.proto.common.v1.ArrayValue] = _root_.scala.None
    def kvlistValue: _root_.scala.Option[io.opentelemetry.proto.common.v1.KeyValueList] = _root_.scala.None
    def bytesValue: _root_.scala.Option[_root_.com.google.protobuf.ByteString] = _root_.scala.None
  }
  object Value {
    @SerialVersionUID(0L)
    case object Empty extends io.opentelemetry.proto.common.v1.AnyValue.Value {
      type ValueType = _root_.scala.Nothing
      override def isEmpty: _root_.scala.Boolean = true
      override def isDefined: _root_.scala.Boolean = false
      override def number: _root_.scala.Int = 0
      override def value: _root_.scala.Nothing = throw new java.util.NoSuchElementException("Empty.value")
    }
  
    @SerialVersionUID(0L)
    final case class StringValue(value: _root_.scala.Predef.String) extends io.opentelemetry.proto.common.v1.AnyValue.Value {
      type ValueType = _root_.scala.Predef.String
      override def isStringValue: _root_.scala.Boolean = true
      override def stringValue: _root_.scala.Option[_root_.scala.Predef.String] = Some(value)
      override def number: _root_.scala.Int = 1
    }
    @SerialVersionUID(0L)
    final case class BoolValue(value: _root_.scala.Boolean) extends io.opentelemetry.proto.common.v1.AnyValue.Value {
      type ValueType = _root_.scala.Boolean
      override def isBoolValue: _root_.scala.Boolean = true
      override def boolValue: _root_.scala.Option[_root_.scala.Boolean] = Some(value)
      override def number: _root_.scala.Int = 2
    }
    @SerialVersionUID(0L)
    final case class IntValue(value: _root_.scala.Long) extends io.opentelemetry.proto.common.v1.AnyValue.Value {
      type ValueType = _root_.scala.Long
      override def isIntValue: _root_.scala.Boolean = true
      override def intValue: _root_.scala.Option[_root_.scala.Long] = Some(value)
      override def number: _root_.scala.Int = 3
    }
    @SerialVersionUID(0L)
    final case class DoubleValue(value: _root_.scala.Double) extends io.opentelemetry.proto.common.v1.AnyValue.Value {
      type ValueType = _root_.scala.Double
      override def isDoubleValue: _root_.scala.Boolean = true
      override def doubleValue: _root_.scala.Option[_root_.scala.Double] = Some(value)
      override def number: _root_.scala.Int = 4
    }
    @SerialVersionUID(0L)
    final case class ArrayValue(value: io.opentelemetry.proto.common.v1.ArrayValue) extends io.opentelemetry.proto.common.v1.AnyValue.Value {
      type ValueType = io.opentelemetry.proto.common.v1.ArrayValue
      override def isArrayValue: _root_.scala.Boolean = true
      override def arrayValue: _root_.scala.Option[io.opentelemetry.proto.common.v1.ArrayValue] = Some(value)
      override def number: _root_.scala.Int = 5
    }
    @SerialVersionUID(0L)
    final case class KvlistValue(value: io.opentelemetry.proto.common.v1.KeyValueList) extends io.opentelemetry.proto.common.v1.AnyValue.Value {
      type ValueType = io.opentelemetry.proto.common.v1.KeyValueList
      override def isKvlistValue: _root_.scala.Boolean = true
      override def kvlistValue: _root_.scala.Option[io.opentelemetry.proto.common.v1.KeyValueList] = Some(value)
      override def number: _root_.scala.Int = 6
    }
    @SerialVersionUID(0L)
    final case class BytesValue(value: _root_.com.google.protobuf.ByteString) extends io.opentelemetry.proto.common.v1.AnyValue.Value {
      type ValueType = _root_.com.google.protobuf.ByteString
      override def isBytesValue: _root_.scala.Boolean = true
      override def bytesValue: _root_.scala.Option[_root_.com.google.protobuf.ByteString] = Some(value)
      override def number: _root_.scala.Int = 7
    }
  }
  implicit class AnyValueLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, io.opentelemetry.proto.common.v1.AnyValue]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, io.opentelemetry.proto.common.v1.AnyValue](_l) {
    def stringValue: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.getStringValue)((c_, f_) => c_.copy(value = io.opentelemetry.proto.common.v1.AnyValue.Value.StringValue(f_)))
    def boolValue: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.getBoolValue)((c_, f_) => c_.copy(value = io.opentelemetry.proto.common.v1.AnyValue.Value.BoolValue(f_)))
    def intValue: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.getIntValue)((c_, f_) => c_.copy(value = io.opentelemetry.proto.common.v1.AnyValue.Value.IntValue(f_)))
    def doubleValue: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Double] = field(_.getDoubleValue)((c_, f_) => c_.copy(value = io.opentelemetry.proto.common.v1.AnyValue.Value.DoubleValue(f_)))
    def arrayValue: _root_.scalapb.lenses.Lens[UpperPB, io.opentelemetry.proto.common.v1.ArrayValue] = field(_.getArrayValue)((c_, f_) => c_.copy(value = io.opentelemetry.proto.common.v1.AnyValue.Value.ArrayValue(f_)))
    def kvlistValue: _root_.scalapb.lenses.Lens[UpperPB, io.opentelemetry.proto.common.v1.KeyValueList] = field(_.getKvlistValue)((c_, f_) => c_.copy(value = io.opentelemetry.proto.common.v1.AnyValue.Value.KvlistValue(f_)))
    def bytesValue: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.getBytesValue)((c_, f_) => c_.copy(value = io.opentelemetry.proto.common.v1.AnyValue.Value.BytesValue(f_)))
    def value: _root_.scalapb.lenses.Lens[UpperPB, io.opentelemetry.proto.common.v1.AnyValue.Value] = field(_.value)((c_, f_) => c_.copy(value = f_))
  }
  final val STRING_VALUE_FIELD_NUMBER = 1
  final val BOOL_VALUE_FIELD_NUMBER = 2
  final val INT_VALUE_FIELD_NUMBER = 3
  final val DOUBLE_VALUE_FIELD_NUMBER = 4
  final val ARRAY_VALUE_FIELD_NUMBER = 5
  final val KVLIST_VALUE_FIELD_NUMBER = 6
  final val BYTES_VALUE_FIELD_NUMBER = 7
  def of(
    value: io.opentelemetry.proto.common.v1.AnyValue.Value
  ): _root_.io.opentelemetry.proto.common.v1.AnyValue = _root_.io.opentelemetry.proto.common.v1.AnyValue(
    value
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[opentelemetry.proto.common.v1.AnyValue])
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy