NavType.Companion


public static class NavType.Companion


Summary

Public methods

static @NonNull NavType<@NonNull ?>
fromArgType(String type, String packageName)

Parse an argType string into a NavType.

static final @NonNull NavType<boolean[]>

NavType for storing boolean arrays, corresponding with the "boolean[]" type in a Navigation XML file.

static final @NonNull NavType<List<@NonNull Boolean>>

NavType for storing list of Booleans.

static final @NonNull NavType<@NonNull Boolean>

NavType for storing boolean values, corresponding with the "boolean" type in a Navigation XML file.

static final @NonNull NavType<float[]>

NavType for storing float arrays, corresponding with the "float[]" type in a Navigation XML file.

static final @NonNull NavType<List<@NonNull Float>>

NavType for storing list of Floats.

static final @NonNull NavType<@NonNull Float>

NavType for storing float values, corresponding with the "float" type in a Navigation XML file.

static final @NonNull NavType<int[]>

NavType for storing integer arrays, corresponding with the "integer[]" type in a Navigation XML file.

static final @NonNull NavType<List<@NonNull Integer>>

NavType for storing list of Ints.

static final @NonNull NavType<@NonNull Integer>

NavType for storing integer values, corresponding with the "integer" type in a Navigation XML file.

static final @NonNull NavType<long[]>

NavType for storing long arrays, corresponding with the "long[]" type in a Navigation XML file.

static final @NonNull NavType<List<@NonNull Long>>

NavType for storing list of Longs.

static final @NonNull NavType<@NonNull Long>

NavType for storing long values, corresponding with the "long" type in a Navigation XML file.

static final @NonNull NavType<String[]>

NavType for storing String arrays, corresponding with the "string[]" type in a Navigation XML file.

static final @NonNull NavType<List<@NonNull String>>

NavType for storing list of Strings.

static final @NonNull NavType<String>

NavType for storing String values, corresponding with the "string" type in a Navigation XML file.

Public methods

fromArgType

Added in 2.4.0
public static @NonNull NavType<@NonNull ?> fromArgType(String type, String packageName)

Parse an argType string into a NavType.

Parameters
String type

argType string, usually parsed from the Navigation XML file

String packageName

package name of the R file, used for parsing relative class names starting with a dot.

Returns
@NonNull NavType<@NonNull ?>

a NavType representing the type indicated by the argType string. Defaults to StringType for null.

Throws
kotlin.IllegalArgumentException

if there is no valid argType

kotlin.RuntimeException

if the type class name cannot be found

getBoolArrayType

public static final @NonNull NavType<boolean[]> getBoolArrayType()

NavType for storing boolean arrays, corresponding with the "boolean[]" type in a Navigation XML file.

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

getBoolListType

public static final @NonNull NavType<List<@NonNull Boolean>> getBoolListType()

NavType for storing list of Booleans.

Null values are supported. List NavTypes in Navigation XML files are not supported.

getBoolType

public static final @NonNull NavType<@NonNull BooleangetBoolType()

NavType for storing boolean values, corresponding with the "boolean" type in a Navigation XML file.

Null values are not supported.

getFloatArrayType

public static final @NonNull NavType<float[]> getFloatArrayType()

NavType for storing float arrays, corresponding with the "float[]" type in a Navigation XML file.

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

getFloatListType

public static final @NonNull NavType<List<@NonNull Float>> getFloatListType()

NavType for storing list of Floats.

Null values are supported. List NavTypes in Navigation XML files are not supported.

getFloatType

public static final @NonNull NavType<@NonNull FloatgetFloatType()

NavType for storing float values, corresponding with the "float" type in a Navigation XML file.

Null values are not supported.

getIntArrayType

public static final @NonNull NavType<int[]> getIntArrayType()

NavType for storing integer arrays, corresponding with the "integer[]" type in a Navigation XML file.

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

getIntListType

public static final @NonNull NavType<List<@NonNull Integer>> getIntListType()

NavType for storing list of Ints.

Null values are supported. List NavTypes in Navigation XML files are not supported.

getIntType

public static final @NonNull NavType<@NonNull IntegergetIntType()

NavType for storing integer values, corresponding with the "integer" type in a Navigation XML file.

Null values are not supported.

getLongArrayType

public static final @NonNull NavType<long[]> getLongArrayType()

NavType for storing long arrays, corresponding with the "long[]" type in a Navigation XML file.

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

getLongListType

public static final @NonNull NavType<List<@NonNull Long>> getLongListType()

NavType for storing list of Longs.

Null values are supported. List NavTypes in Navigation XML files are not supported.

getLongType

public static final @NonNull NavType<@NonNull LonggetLongType()

NavType for storing long values, corresponding with the "long" type in a Navigation XML file.

Null values are not supported. Default values for this type in Navigation XML files must always end with an 'L' suffix, e.g. app:defaultValue="123L".

getStringArrayType

public static final @NonNull NavType<String[]> getStringArrayType()

NavType for storing String arrays, corresponding with the "string[]" type in a Navigation XML file.

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

getStringListType

public static final @NonNull NavType<List<@NonNull String>> getStringListType()

NavType for storing list of Strings.

Null values are supported. List NavTypes in Navigation XML files are not supported.

getStringType

public static final @NonNull NavType<StringgetStringType()

NavType for storing String values, corresponding with the "string" type in a Navigation XML file.

Null values are supported.