Skip to content
This repository was archived by the owner on May 10, 2022. It is now read-only.
This repository was archived by the owner on May 10, 2022. It is now read-only.

Add support for dagger scopes #3

Description

@AlexanderEggers

Scopes provide the user with a wider ability to structure the dependency graph. Currently ArchKnife provides no support for that - everything is scoped as Singleton (or no scope of course).

In order to provide this features, there are different steps required as well as several core library changes (to ArchKnife).

  • Extend each Provide(...) annotation to include a scope annotation class as member. By default it should use Singleton::class.
  • Add new annotation ProvideScope. This class has the member dependency. If null, it will use the AppComponent (Singleton scope) as dependency. This annotation can only be used on other annotations. Therefore the dev needs to create a scope annotation class which then will be used by the ArchKnife processor.
  • Add new processor that will create app component classes that will use the dependent member based on the dependency value. Each scope will be mapped against a certain component class.
  • The component processor needs to create the builder modules (activity, fragment, viewmodel, ...) based on the scope.
  • Renamed ArchKnifeComponent to AppComponent
  • Add new processor that is creating a static object that is holding the references for the components and provides options to retrieve the component instance and to clear a given one (simplify set it to null). The getter ensures to always return non-null objects.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions