TypeProtoConverters


class TypeProtoConverters


Converters from Any proto messages to their unwrapped target types.

Summary

Public functions

java-static T!
<T> anyToType(any: Any)

Performs an Any proto message to type T conversion.

java-static Parcelable!
byteStringToParcelable(
    byteString: ByteString,
    parcelableClass: Class<Parcelable!>
)

Performs a ByteString to Parcelable conversion.

java-static T!
<T> byteStringToType(byteString: ByteString)

Performs a ByteString to type T conversion.

java-static ByteString!

Performs Parcelable to ByteString conversion.

java-static Any!
<T> typeToAny(type: T)

Performs a type T to Any proto message conversion.

java-static ByteString!

Performs an object to ByteString conversion.

Public functions

anyToType

java-static fun <T> anyToType(any: Any): T!

Performs an Any proto message to type T conversion.

Parameters
any: Any

type to unwrap into its target type T representation

Returns
T!

unwrapped target type T

byteStringToParcelable

java-static fun byteStringToParcelable(
    byteString: ByteString,
    parcelableClass: Class<Parcelable!>
): Parcelable!

Performs a ByteString to Parcelable conversion.

Parameters
byteString: ByteString

the ByteString to convert to a Parcelable

parcelableClass: Class<Parcelable!>

the class type to create

Returns
Parcelable!

instance of Parcelable

byteStringToType

java-static fun <T> byteStringToType(byteString: ByteString): T!

Performs a ByteString to type T conversion.

Parameters
byteString: ByteString

the ByteString to convert into T

Returns
T!

instance of type T

parcelableToByteString

java-static fun parcelableToByteString(parcelable: Parcelable): ByteString!

Performs Parcelable to ByteString conversion.

Parameters
parcelable: Parcelable

Parcelable to convert to a ByteString

Returns
ByteString!

ByteString representation of the passed object

typeToAny

java-static fun <T> typeToAny(type: T): Any!

Performs a type T to Any proto message conversion.

Parameters
type: T

target type to wrap into its Any representation

Returns
Any!

Any proto message which contains the wrapped proto representation of T

typeToByteString

java-static fun typeToByteString(object: Any): ByteString!

Performs an object to ByteString conversion.

Parameters
object: Any

object to convert to a ByteString

Returns
ByteString!

ByteString representation of the passed object