Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification needed about Scope annotation #417

Open
afaucogney opened this issue Aug 9, 2020 · 0 comments
Open

Clarification needed about Scope annotation #417

afaucogney opened this issue Aug 9, 2020 · 0 comments

Comments

@afaucogney
Copy link

Could you maybe rephrase the definition, or the target of the feature, because I do not understand well how it does work and for what purpose it is !

the doc says : https://github.com/stephanenicolas/toothpick/wiki/Scope-Annotations

Annotating Bar with @ActivityScope means "All instances of Bar should belong to a scope that supports the scope annotation @ActivityScope". All the dependencies of Bar will also be found in such a scope or its parents.

As an example, if we take an app with 2 activities, that owns a dedicated scope.

  • If both activities (without support of @ActivityScope) will inject Bar() => KTP will complain ? Runtime or compile time ?
  • If both activities (with support of @ActivityScope) will inject Bar() => KTP will inject bar depending on binding setup by KTP in each activity ?
  • If both activities (with support of @ActivityScope) => does not mean this is the same scope for both activity, but same type of scope (more or less)
  • If both activities (with support of @ActivityScope) will inject Bar() => does not mean Bar() has the same instance management in both activity instance (eg singleton), it really depend of each scope bind setup ?
  • If only a single activity from 2 would have support for the @ActivityScope, this means, Bar should only be injected in this activity, but not in the other activity scope ?

Did I understand it ?

Could someone give more operationnal / industrial use cases about this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant