NavType.SerializableArrayType

public final class NavType.SerializableArrayType<D extends Serializable> extends NavType


SerializableArrayType is used for NavArguments that hold arrays of Serializables. This type also supports arrays of Enums.

Null values are supported. Default values in Navigation XML files are not supported.

Summary

Public fields

boolean

Check if an argument with this type can hold a null value.

@NonNull String

The name of this type.

Public constructors

Public methods

boolean
@Nullable Array<@NonNull D>
get(@NonNull Bundle bundle, @NonNull String key)

Get a value of this type from the bundle

int
@NonNull Array<@NonNull D>
void
put(
    @NonNull Bundle bundle,
    @NonNull String key,
    @Nullable Array<@NonNull D> value
)

Put a value of this type in the bundle

Inherited methods

From class NavType

Public fields

isNullableAllowed

@NonNull
public boolean isNullableAllowed

Check if an argument with this type can hold a null value.

Returns
boolean

Returns true if this type allows null values, false otherwise.

name

@NonNull
public @NonNull String name

The name of this type.

This is the same value that is used in Navigation XML argType attribute.

Returns
@NonNull String

name of this type

Public constructors

SerializableArrayType

public final <D extends Serializable> SerializableArrayType(@NonNull Class<@NonNull D> type)
Parameters
@NonNull Class<@NonNull D> type

the Serializable component class of the array

Public methods

equals

@NonNull
public boolean equals(@Nullable Object other)

get

@Nullable
public Array<@NonNull D> get(@NonNull Bundle bundle, @NonNull String key)

Get a value of this type from the bundle

Parameters
@NonNull Bundle bundle

bundle to get value from

@NonNull String key

bundle key

Returns
Array<@NonNull D>

value of this type

hashCode

@NonNull
public int hashCode()

parseValue

@NonNull
public Array<@NonNull D> parseValue(@NonNull String value)
Throws
kotlin.UnsupportedOperationException

since Arrays do not support default values

put

@NonNull
public void put(
    @NonNull Bundle bundle,
    @NonNull String key,
    @Nullable Array<@NonNull D> value
)

Put a value of this type in the bundle

Parameters
@NonNull Bundle bundle

bundle to put value in

@NonNull String key

bundle key

@Nullable Array<@NonNull D> value

value of this type