Introducing HiltBinder: An annotation processing l...
# feed
p
Introducing HiltBinder: An annotation processing library that automatically generates Dagger Hilt's @Binds methods. Just annotate your class with the @BindType annotation:
Copy code
interface ImageLoader

@BindType
class GlideImageLoader @Inject constructor(): ImageLoader
and HiltBinder will generate the following:
Copy code
@Module
@InstallIn(SingletonComponent.class)
public interface HiltBinder_SingletonComponentModule {
  @Binds
  ImageLoader bind_GlideImageLoader(GlideImageLoader binding);
}
HiltBinder supports lots of features: • Specifying a particular type to bind to. • Installing bindings in both Dagger Hilt's predefined and custom components. • Contributing bindings into a set and map collections (Dagger multibindings). • Associating bindings with Dagger qualifiers. • KSP support. For more info, take a look at the GitHub repository that contains extensive documentation for the API as well as sample application to showcase the library in action.
💯 1
n
This feature is closer to dependency injection in spring boot