Package dagger.hilt

Annotation Interface DefineComponent


@Retention(CLASS) @Target(TYPE) public @interface DefineComponent
Defines a Hilt component.

Example defining a root component, ParentComponent:


   @ParentScoped
   @DefineComponent
   interface ParentComponent {}
 

Example defining a child component, ChildComponent:


   @ChildScoped
   @DefineComponent(parent = ParentComponent.class)
   interface ChildComponent {}
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static @interface 
    Defines a builder for a Hilt component.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Returns the parent of this component, if it exists.
  • Element Details

    • parent

      Class<?> parent
      Returns the parent of this component, if it exists.
      Default:
      dagger.hilt.internal.definecomponent.DefineComponentNoParent.class