Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3
package com.google.protobuf.any
import scala.collection.JavaConversions._
/** `Any` contains an arbitrary serialized protocol buffer message along with a
* URL that describes the type of the serialized message.
*
* Protobuf library provides support to pack/unpack Any values in the form
* of utility functions or additional generated methods of the Any type.
*
* Example 1: Pack and unpack a message in C++.
*
* Foo foo = ...;
* Any any;
* any.PackFrom(foo);
* ...
* if (any.UnpackTo(&foo)) {
* ...
* }
*
* Example 2: Pack and unpack a message in Java.
*
* Foo foo = ...;
* Any any = Any.pack(foo);
* ...
* if (any.is(Foo.class)) {
* foo = any.unpack(Foo.class);
* }
*
* Example 3: Pack and unpack a message in Python.
*
* foo = Foo(...)
* any = Any()
* any.Pack(foo)
* ...
* if any.Is(Foo.DESCRIPTOR):
* any.Unpack(foo)
* ...
*
* The pack methods provided by protobuf library will by default use
* 'type.googleapis.com/full.type.name' as the type URL and the unpack
* methods only use the fully qualified type name after the last '/'
* in the type URL, for example "foo.bar.com/x/y.z" will yield type
* name "y.z".
*
*
* JSON
* ====
* The JSON representation of an `Any` value uses the regular
* representation of the deserialized, embedded message, with an
* additional field `@type` which contains the type URL. Example:
*
* package google.profile;
* message Person {
* string first_name = 1;
* string last_name = 2;
* }
*
* {
* "@type": "type.googleapis.com/google.profile.Person",
* "firstName": <string>,
* "lastName": <string>
* }
*
* If the embedded message type is well-known and has a custom JSON
* representation, that representation will be embedded adding a field
* `value` which holds the custom JSON in addition to the `@type`
* field. Example (for message [google.protobuf.Duration][]):
*
* {
* "@type": "type.googleapis.com/google.protobuf.Duration",
* "value": "1.212s"
* }
*
* @param typeUrl
* A URL/resource name whose content describes the type of the
* serialized protocol buffer message.
*
* For URLs which use the scheme `http`, `https`, or no scheme, the
* following restrictions and interpretations apply:
*
* * If no scheme is provided, `https` is assumed.
* * The last segment of the URL's path must represent the fully
* qualified name of the type (as in `path/google.protobuf.Duration`).
* The name should be in a canonical form (e.g., leading "." is
* not accepted).
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
* value in binary format, or produce an error.
* * Applications are allowed to cache lookup results based on the
* URL, or have them precompiled into a binary to avoid any
* lookup. Therefore, binary compatibility needs to be preserved
* on changes to types. (Use versioned type names to manage
* breaking changes.)
*
* Schemes other than `http`, `https` (or the empty scheme) might be
* used with implementation specific semantics.
* @param value
* Must be a valid serialized protocol buffer of the above specified type.
*/
@SerialVersionUID(0L)
final case class Any(
typeUrl: String = "",
value: com.google.protobuf.ByteString = com.google.protobuf.ByteString.EMPTY
) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[Any] with com.trueaccord.lenses.Updatable[Any] with com.trueaccord.scalapb.AnyMethods {
@transient
private[this] var __serializedSizeCachedValue: Int = 0
private[this] def __computeSerializedValue(): Int = {
var __size = 0
if (typeUrl != "") { __size += com.google.protobuf.CodedOutputStream.computeStringSize(1, typeUrl) }
if (value != com.google.protobuf.ByteString.EMPTY) { __size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, value) }
__size
}
final override def serializedSize: Int = {
var read = __serializedSizeCachedValue
if (read == 0) {
read = __computeSerializedValue()
__serializedSizeCachedValue = read
}
read
}
def writeTo(`_output__`: com.google.protobuf.CodedOutputStream): Unit = {
{
val __v = typeUrl
if (__v != "") {
_output__.writeString(1, __v)
}
};
{
val __v = value
if (__v != com.google.protobuf.ByteString.EMPTY) {
_output__.writeBytes(2, __v)
}
};
}
def mergeFrom(`_input__`: com.google.protobuf.CodedInputStream): com.google.protobuf.any.Any = {
var __typeUrl = this.typeUrl
var __value = this.value
var _done__ = false
while (!_done__) {
val _tag__ = _input__.readTag()
_tag__ match {
case 0 => _done__ = true
case 10 =>
__typeUrl = _input__.readString()
case 18 =>
__value = _input__.readBytes()
case tag => _input__.skipField(tag)
}
}
com.google.protobuf.any.Any(
typeUrl = __typeUrl,
value = __value
)
}
def withTypeUrl(__v: String): Any = copy(typeUrl = __v)
def withValue(__v: com.google.protobuf.ByteString): Any = copy(value = __v)
def getField(__field: com.google.protobuf.Descriptors.FieldDescriptor): scala.Any = {
__field.getNumber match {
case 1 => {
val __t = typeUrl
if (__t != "") __t else null
}
case 2 => {
val __t = value
if (__t != com.google.protobuf.ByteString.EMPTY) __t else null
}
}
}
override def toString: String = com.trueaccord.scalapb.TextFormat.printToUnicodeString(this)
def companion = com.google.protobuf.any.Any
}
object Any extends com.trueaccord.scalapb.GeneratedMessageCompanion[com.google.protobuf.any.Any] with com.trueaccord.scalapb.JavaProtoSupport[com.google.protobuf.any.Any, com.google.protobuf.Any] with com.trueaccord.scalapb.AnyCompanionMethods {
implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[com.google.protobuf.any.Any] with com.trueaccord.scalapb.JavaProtoSupport[com.google.protobuf.any.Any, com.google.protobuf.Any] with com.trueaccord.scalapb.AnyCompanionMethods = this
def toJavaProto(scalaPbSource: com.google.protobuf.any.Any): com.google.protobuf.Any = {
val javaPbOut = com.google.protobuf.Any.newBuilder
javaPbOut.setTypeUrl(scalaPbSource.typeUrl)
javaPbOut.setValue(scalaPbSource.value)
javaPbOut.build
}
def fromJavaProto(javaPbSource: com.google.protobuf.Any): com.google.protobuf.any.Any = com.google.protobuf.any.Any(
typeUrl = javaPbSource.getTypeUrl,
value = javaPbSource.getValue
)
def fromFieldsMap(__fieldsMap: scala.collection.immutable.Map[com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.google.protobuf.any.Any = {
require(__fieldsMap.keys.forall(_.getContainingType() == descriptor), "FieldDescriptor does not match message type.")
val __fields = descriptor.getFields
com.google.protobuf.any.Any(
__fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[String],
__fieldsMap.getOrElse(__fields.get(1), com.google.protobuf.ByteString.EMPTY).asInstanceOf[com.google.protobuf.ByteString]
)
}
def descriptor: com.google.protobuf.Descriptors.Descriptor = AnyProto.descriptor.getMessageTypes.get(0)
def messageCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__field)
def enumCompanionForField(__field: com.google.protobuf.Descriptors.FieldDescriptor): com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__field)
lazy val defaultInstance = com.google.protobuf.any.Any(
)
implicit class AnyLens[UpperPB](_l: com.trueaccord.lenses.Lens[UpperPB, com.google.protobuf.any.Any]) extends com.trueaccord.lenses.ObjectLens[UpperPB, com.google.protobuf.any.Any](_l) {
def typeUrl: com.trueaccord.lenses.Lens[UpperPB, String] = field(_.typeUrl)((c_, f_) => c_.copy(typeUrl = f_))
def value: com.trueaccord.lenses.Lens[UpperPB, com.google.protobuf.ByteString] = field(_.value)((c_, f_) => c_.copy(value = f_))
}
final val TYPE_URL_FIELD_NUMBER = 1
final val VALUE_FIELD_NUMBER = 2
}