Class HiltViewModelFactory
java.lang.Object
dagger.hilt.android.internal.lifecycle.HiltViewModelFactory
- All Implemented Interfaces:
androidx.lifecycle.ViewModelProvider.Factory
public final class HiltViewModelFactory
extends Object
implements androidx.lifecycle.ViewModelProvider.Factory
View Model Provider Factory for the Hilt Extension.
A provider for this factory will be installed in the ActivityComponent
and FragmentComponent
. An instance of this factory will also be the
default factory by activities and fragments annotated with AndroidEntryPoint
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Hilt entry point for getting the multi-binding map of ViewModels.Nested classes/interfaces inherited from interface androidx.lifecycle.ViewModelProvider.Factory
androidx.lifecycle.ViewModelProvider.Factory.Companion
-
Field Summary
Modifier and TypeFieldDescriptionstatic final androidx.lifecycle.viewmodel.CreationExtras.Key<kotlin.jvm.functions.Function1<Object,
androidx.lifecycle.ViewModel>> Creation extra key for the callbacks that create @AssistedInject-annotated ViewModels.Fields inherited from interface androidx.lifecycle.ViewModelProvider.Factory
Companion
-
Constructor Summary
ConstructorDescriptionHiltViewModelFactory
(Map<Class<?>, Boolean> hiltViewModelKeys, androidx.lifecycle.ViewModelProvider.Factory delegateFactory, ViewModelComponentBuilder viewModelComponentBuilder) -
Method Summary
Modifier and TypeMethodDescription<T extends androidx.lifecycle.ViewModel>
T<T extends androidx.lifecycle.ViewModel>
Tstatic androidx.lifecycle.ViewModelProvider.Factory
createInternal
(android.app.Activity activity, androidx.lifecycle.ViewModelProvider.Factory delegateFactory) static androidx.lifecycle.ViewModelProvider.Factory
createInternal
(android.app.Activity activity, androidx.savedstate.SavedStateRegistryOwner owner, android.os.Bundle defaultArgs, androidx.lifecycle.ViewModelProvider.Factory delegateFactory)
-
Field Details
-
CREATION_CALLBACK_KEY
public static final androidx.lifecycle.viewmodel.CreationExtras.Key<kotlin.jvm.functions.Function1<Object,androidx.lifecycle.ViewModel>> CREATION_CALLBACK_KEYCreation extra key for the callbacks that create @AssistedInject-annotated ViewModels.
-
-
Constructor Details
-
HiltViewModelFactory
public HiltViewModelFactory(@NonNull Map<Class<?>, Boolean> hiltViewModelKeys, @NonNull androidx.lifecycle.ViewModelProvider.Factory delegateFactory, @NonNull ViewModelComponentBuilder viewModelComponentBuilder)
-
-
Method Details
-
create
@NonNull public <T extends androidx.lifecycle.ViewModel> T create(@NonNull Class<T> modelClass, @NonNull androidx.lifecycle.viewmodel.CreationExtras extras) - Specified by:
create
in interfaceandroidx.lifecycle.ViewModelProvider.Factory
-
create
- Specified by:
create
in interfaceandroidx.lifecycle.ViewModelProvider.Factory
-
createInternal
public static androidx.lifecycle.ViewModelProvider.Factory createInternal(@NonNull android.app.Activity activity, @NonNull androidx.savedstate.SavedStateRegistryOwner owner, @Nullable android.os.Bundle defaultArgs, @NonNull androidx.lifecycle.ViewModelProvider.Factory delegateFactory) -
createInternal
public static androidx.lifecycle.ViewModelProvider.Factory createInternal(@NonNull android.app.Activity activity, @NonNull androidx.lifecycle.ViewModelProvider.Factory delegateFactory)
-