{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}
public final class TypeProtoConverters
Converters from Any proto messages to their unwrapped target types.
Public constructors |
|
|---|---|
Public methods |
|
|---|---|
static T |
Performs an Any proto message to type T conversion. |
static Parcelable |
byteStringToParcelable(Performs a ByteString to |
static T |
<T> byteStringToType(@NonNull ByteString byteString)Performs a ByteString to type T conversion. |
static ByteString |
parcelableToByteString(@NonNull Parcelable parcelable)Performs |
static Any |
Performs a type T to Any proto message conversion. |
static ByteString |
typeToByteString(@NonNull Object object)Performs an object to ByteString conversion. |
public static T <T> anyToType(@NonNull Any any)
Performs an Any proto message to type T conversion.
| Parameters | |
|---|---|
@NonNull Any any |
type to unwrap into its target type T representation |
| Returns | |
|---|---|
T |
unwrapped target type T |
public static Parcelable byteStringToParcelable(
@NonNull ByteString byteString,
@NonNull Class<Parcelable> parcelableClass
)
Performs a ByteString to Parcelable conversion.
| Parameters | |
|---|---|
@NonNull ByteString byteString |
the ByteString to convert to a |
| Returns | |
|---|---|
Parcelable |
instance of |
public static T <T> byteStringToType(@NonNull ByteString byteString)
Performs a ByteString to type T conversion.
| Parameters | |
|---|---|
@NonNull ByteString byteString |
the ByteString to convert into T |
| Returns | |
|---|---|
T |
instance of type T |
public static ByteString parcelableToByteString(@NonNull Parcelable parcelable)
Performs Parcelable to ByteString conversion.
| Parameters | |
|---|---|
@NonNull Parcelable parcelable |
|
| Returns | |
|---|---|
ByteString |
ByteString representation of the passed object |
public static Any <T> typeToAny(@NonNull T type)
Performs a type T to Any proto message conversion.
| Parameters | |
|---|---|
@NonNull T type |
target type to wrap into its Any representation |
| Returns | |
|---|---|
Any |
Any proto message which contains the wrapped proto representation of T |
public static ByteString typeToByteString(@NonNull Object object)
Performs an object to ByteString conversion.
| Returns | |
|---|---|
ByteString |
ByteString representation of the passed object |