contains
Checks if this Any message contains a message of type T.
This method examines the type URL Any.typeUrl and compares it against the fully qualified protobuf message type name of T. The check is performed by verifying that the type URL ends with "/<fully.qualified.message.name>".
Example:
val any = Any.pack(Timestamp { seconds = 123 })
if (any.contains<Timestamp>()) {
val timestamp = any.unpack<Timestamp>()
}Return
true if this Any contains a message of type T, false otherwise
Type Parameters
the protobuf message type to check for
See also
Checks if this Any message contains a message of the specified messageClass type.
This method examines the type URL Any.typeUrl and compares it against the fully qualified protobuf message type name of T. The check is performed by verifying that the type URL ends with "/<fully.qualified.message.name>".
Example:
val any = Any.pack(Duration { seconds = 60 })
if (any.contains(Duration::class)) {
val duration = any.unpack<Duration>()
}Return
true if this Any contains a message of type messageClass, false otherwise
Parameters
the KClass of the message type to check
Type Parameters
the protobuf message type to check for
See also
Checks if this Any message contains a message of the specified messageType type.
This method examines the type URL Any.typeUrl and compares it against the fully qualified protobuf message type name of T. The check is performed by verifying that the type URL ends with "/<fully.qualified.message.name>".
Example:
val any = Any.pack(Duration { seconds = 60 })
if (any.contains<Duration>(typeOf<Duration>)) {
val duration = any.unpack<Duration>()
}Return
true if this Any contains a message of type messageType, false otherwise
Parameters
the message KType to check
Type Parameters
the protobuf message type to check for