ProtoAny

nscn.polaris2.protoc.runtime.ProtoAny
See theProtoAny companion object
final case class ProtoAny(typeUrl: String, value: ByteString)

The Scala shape of google.protobuf.Any: a type URL and the bytes it describes.

Kept as its own type rather than mapped to a stdlib one, because there is no stdlib type for "some message, identified at runtime". pack and unpackTo are where the type recovery happens, and they need the target's companion, which is exactly what a generated companion provides.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def is[A <: GeneratedMessage](using companion: GeneratedMessageCompanion[A]): Boolean
def messageName: String

The fully-qualified proto name the URL points at.

The fully-qualified proto name the URL points at.

Attributes

def toJava: Any
def unpackOption[A <: GeneratedMessage](using companion: GeneratedMessageCompanion[A]): Option[A]
def unpackTo[A <: GeneratedMessage](using companion: GeneratedMessageCompanion[A]): A

Parses the payload as A, failing when the type URL names something else.

Parses the payload as A, failing when the type URL names something else.

Checked rather than trusting: an Any arrives from the network, and parsing arbitrary bytes as the wrong message usually succeeds while producing nonsense.

Attributes

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product