org.yupana.proto.Value.scala Maven / Gradle / Ivy
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO2
package org.yupana.proto
@SerialVersionUID(0L)
final case class Value(
value: org.yupana.proto.Value.Value = org.yupana.proto.Value.Value.Empty
) extends scalapb.GeneratedMessage with scalapb.Message[Value] with scalapb.lenses.Updatable[Value] {
@transient
private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0
private[this] def __computeSerializedValue(): _root_.scala.Int = {
var __size = 0
if (value.textValue.isDefined) {
val __value = value.textValue.get
__size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(4, __value)
};
if (value.decimalValue.isDefined) {
val __value = value.decimalValue.get
__size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(5, __value)
};
if (value.timeValue.isDefined) {
val __value = value.timeValue.get
__size += _root_.com.google.protobuf.CodedOutputStream.computeUInt64Size(6, __value)
};
__size
}
final override def serializedSize: _root_.scala.Int = {
var read = __serializedSizeCachedValue
if (read == 0) {
read = __computeSerializedValue()
__serializedSizeCachedValue = read
}
read
}
def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
value.textValue.foreach { __v =>
val __m = __v
_output__.writeString(4, __m)
};
value.decimalValue.foreach { __v =>
val __m = __v
_output__.writeString(5, __m)
};
value.timeValue.foreach { __v =>
val __m = __v
_output__.writeUInt64(6, __m)
};
}
def mergeFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): org.yupana.proto.Value = {
var __value = this.value
var _done__ = false
while (!_done__) {
val _tag__ = _input__.readTag()
_tag__ match {
case 0 => _done__ = true
case 34 =>
__value = org.yupana.proto.Value.Value.TextValue(_input__.readString())
case 42 =>
__value = org.yupana.proto.Value.Value.DecimalValue(_input__.readString())
case 48 =>
__value = org.yupana.proto.Value.Value.TimeValue(_input__.readUInt64())
case tag => _input__.skipField(tag)
}
}
org.yupana.proto.Value(
value = __value
)
}
def getTextValue: _root_.scala.Predef.String = value.textValue.getOrElse("")
def withTextValue(__v: _root_.scala.Predef.String): Value = copy(value = org.yupana.proto.Value.Value.TextValue(__v))
def getDecimalValue: _root_.scala.Predef.String = value.decimalValue.getOrElse("")
def withDecimalValue(__v: _root_.scala.Predef.String): Value = copy(value = org.yupana.proto.Value.Value.DecimalValue(__v))
def getTimeValue: _root_.scala.Long = value.timeValue.getOrElse(0L)
def withTimeValue(__v: _root_.scala.Long): Value = copy(value = org.yupana.proto.Value.Value.TimeValue(__v))
def clearValue: Value = copy(value = org.yupana.proto.Value.Value.Empty)
def withValue(__v: org.yupana.proto.Value.Value): Value = copy(value = __v)
def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
(__fieldNumber: @_root_.scala.unchecked) match {
case 4 => value.textValue.orNull
case 5 => value.decimalValue.orNull
case 6 => value.timeValue.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 4 => value.textValue.map(_root_.scalapb.descriptors.PString).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 5 => value.decimalValue.map(_root_.scalapb.descriptors.PString).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 6 => value.timeValue.map(_root_.scalapb.descriptors.PLong).getOrElse(_root_.scalapb.descriptors.PEmpty)
}
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion = org.yupana.proto.Value
}
object Value extends scalapb.GeneratedMessageCompanion[org.yupana.proto.Value] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[org.yupana.proto.Value] = this
def fromFieldsMap(__fieldsMap: scala.collection.immutable.Map[_root_.com.google.protobuf.Descriptors.FieldDescriptor, _root_.scala.Any]): org.yupana.proto.Value = {
_root_.scala.Predef.require(__fieldsMap.keys.forall(_.getContainingType() == javaDescriptor), "FieldDescriptor does not match message type.")
val __fields = javaDescriptor.getFields
org.yupana.proto.Value(
value = __fieldsMap.get(__fields.get(0)).asInstanceOf[_root_.scala.Option[_root_.scala.Predef.String]].map(org.yupana.proto.Value.Value.TextValue)
.orElse[org.yupana.proto.Value.Value](__fieldsMap.get(__fields.get(1)).asInstanceOf[_root_.scala.Option[_root_.scala.Predef.String]].map(org.yupana.proto.Value.Value.DecimalValue))
.orElse[org.yupana.proto.Value.Value](__fieldsMap.get(__fields.get(2)).asInstanceOf[_root_.scala.Option[_root_.scala.Long]].map(org.yupana.proto.Value.Value.TimeValue))
.getOrElse(org.yupana.proto.Value.Value.Empty)
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[org.yupana.proto.Value] = _root_.scalapb.descriptors.Reads{
case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
_root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage == scalaDescriptor), "FieldDescriptor does not match message type.")
org.yupana.proto.Value(
value = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Predef.String]]).map(org.yupana.proto.Value.Value.TextValue)
.orElse[org.yupana.proto.Value.Value](__fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Predef.String]]).map(org.yupana.proto.Value.Value.DecimalValue))
.orElse[org.yupana.proto.Value.Value](__fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Long]]).map(org.yupana.proto.Value.Value.TimeValue))
.getOrElse(org.yupana.proto.Value.Value.Empty)
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ProtoProto.javaDescriptor.getMessageTypes.get(7)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ProtoProto.scalaDescriptor.messages(7)
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 = org.yupana.proto.Value(
value = org.yupana.proto.Value.Value.Empty
)
sealed trait Value extends _root_.scalapb.GeneratedOneof {
def isEmpty: _root_.scala.Boolean = false
def isDefined: _root_.scala.Boolean = true
def isTextValue: _root_.scala.Boolean = false
def isDecimalValue: _root_.scala.Boolean = false
def isTimeValue: _root_.scala.Boolean = false
def textValue: _root_.scala.Option[_root_.scala.Predef.String] = _root_.scala.None
def decimalValue: _root_.scala.Option[_root_.scala.Predef.String] = _root_.scala.None
def timeValue: _root_.scala.Option[_root_.scala.Long] = _root_.scala.None
}
object Value extends {
@SerialVersionUID(0L)
case object Empty extends org.yupana.proto.Value.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 TextValue(value: _root_.scala.Predef.String) extends org.yupana.proto.Value.Value {
type ValueType = _root_.scala.Predef.String
override def isTextValue: _root_.scala.Boolean = true
override def textValue: _root_.scala.Option[_root_.scala.Predef.String] = Some(value)
override def number: _root_.scala.Int = 4
}
@SerialVersionUID(0L)
final case class DecimalValue(value: _root_.scala.Predef.String) extends org.yupana.proto.Value.Value {
type ValueType = _root_.scala.Predef.String
override def isDecimalValue: _root_.scala.Boolean = true
override def decimalValue: _root_.scala.Option[_root_.scala.Predef.String] = Some(value)
override def number: _root_.scala.Int = 5
}
@SerialVersionUID(0L)
final case class TimeValue(value: _root_.scala.Long) extends org.yupana.proto.Value.Value {
type ValueType = _root_.scala.Long
override def isTimeValue: _root_.scala.Boolean = true
override def timeValue: _root_.scala.Option[_root_.scala.Long] = Some(value)
override def number: _root_.scala.Int = 6
}
}
implicit class ValueLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, org.yupana.proto.Value]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, org.yupana.proto.Value](_l) {
def textValue: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.getTextValue)((c_, f_) => c_.copy(value = org.yupana.proto.Value.Value.TextValue(f_)))
def decimalValue: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.getDecimalValue)((c_, f_) => c_.copy(value = org.yupana.proto.Value.Value.DecimalValue(f_)))
def timeValue: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Long] = field(_.getTimeValue)((c_, f_) => c_.copy(value = org.yupana.proto.Value.Value.TimeValue(f_)))
def value: _root_.scalapb.lenses.Lens[UpperPB, org.yupana.proto.Value.Value] = field(_.value)((c_, f_) => c_.copy(value = f_))
}
final val TEXTVALUE_FIELD_NUMBER = 4
final val DECIMALVALUE_FIELD_NUMBER = 5
final val TIMEVALUE_FIELD_NUMBER = 6
def of(
value: org.yupana.proto.Value.Value
): _root_.org.yupana.proto.Value = _root_.org.yupana.proto.Value(
value
)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy