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

    Nested Classes
    Modifier and Type
    Class
    Description
    static 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

    Fields
    Modifier and Type
    Field
    Description
    static 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

    Constructors
    Constructor
    Description
    HiltViewModelFactory(Map<Class<?>,Boolean> hiltViewModelKeys, androidx.lifecycle.ViewModelProvider.Factory delegateFactory, ViewModelComponentBuilder viewModelComponentBuilder)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T extends androidx.lifecycle.ViewModel>
    T
    create(Class<T> modelClass)
     
    <T extends androidx.lifecycle.ViewModel>
    T
    create(Class<T> modelClass, androidx.lifecycle.viewmodel.CreationExtras extras)
     
    static 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)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CREATION_CALLBACK_KEY

      public static final androidx.lifecycle.viewmodel.CreationExtras.Key<kotlin.jvm.functions.Function1<Object,androidx.lifecycle.ViewModel>> CREATION_CALLBACK_KEY
      Creation 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 interface androidx.lifecycle.ViewModelProvider.Factory
    • create

      @NonNull public <T extends androidx.lifecycle.ViewModel> T create(@NonNull Class<T> modelClass)
      Specified by:
      create in interface androidx.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)