NavArgument
public final class NavArgument
NavArgument denotes an argument that is supported by a NavDestination.
A NavArgument has a type and optionally a default value, that are used to read/write it in a Bundle. It can also be nullable if the type supports it.
Summary
Nested types |
|
|---|---|
NavArgument.Builder |
A builder for constructing |
Public fields |
|
|---|---|
final @Nullable Object |
The default value of this argument or |
final boolean |
Used to distinguish between a default value of |
final boolean |
Whether this argument allows passing a |
final @NonNull NavType<@NonNull Object> |
The type of this NavArgument. |
Public methods |
|
|---|---|
boolean |
|
int |
hashCode() |
final @RestrictTo(value = [RestrictTo.Scope.LIBRARY_GROUP]) void |
putDefaultValue(@NonNull String name, @NonNull Bundle bundle) |
final @RestrictTo(value = [RestrictTo.Scope.LIBRARY_GROUP]) boolean |
|
Public fields
defaultValue
@Nullable
public final @Nullable Object defaultValue
The default value of this argument or null if it doesn't have a default value. Use isDefaultValuePresent to distinguish between null and absence of a value.
isDefaultValuePresent
@NonNull
public final boolean isDefaultValuePresent
Used to distinguish between a default value of null and an argument without an explicit default value.
| Returns | |
|---|---|
boolean |
true if this argument has a default value (even if that value is set to null), false otherwise |
isNullable
@NonNull
public final boolean isNullable
Whether this argument allows passing a null value.
| Returns | |
|---|---|
boolean |
true if |
Public methods
putDefaultValue
@RestrictTo(value = [RestrictTo.Scope.LIBRARY_GROUP])
@NonNull
public final @RestrictTo(value = [RestrictTo.Scope.LIBRARY_GROUP]) void putDefaultValue(@NonNull String name, @NonNull Bundle bundle)
verify
@RestrictTo(value = [RestrictTo.Scope.LIBRARY_GROUP])
@NonNull
public final @RestrictTo(value = [RestrictTo.Scope.LIBRARY_GROUP]) boolean verify(@NonNull String name, @NonNull Bundle bundle)