Comments (12)
I like graph roots but I don't love the word root because it's technically inconsistent.
A tree is called a rooted tree if one vertex has been designated the root, in which case the edges have a natural orientation, towards or away from the root. [...]
In Dagger, any node in the graph can be an entry point.
from dagger.
I thought about this today too, same concerns. What about injectPoints? This would align with callers of the inject() method.
from dagger.
Injection points are already defined to be the members with @Inject
annotations.
from dagger.
Hmm I see... perhaps injectors
would be more concise. I'm somewhat surprised that these objects can't be gathered at compile time. Perhaps it's for flexibility, to avoid a static annotation such as @Injector
on the class, however, I could see myself using @Injector
on all my classes that need to inject.
from dagger.
I've had to explain it quite a few times as well and I don't think the name is the sticking point so much as the concept. The name seems completely appropriate, I'd just recommend adding a few more examples to the docs and coming up with a more concise explanation (easier said than done, of course).
I've found that people pick the concept up quickest when I explain that an entry point is any class that makes explicit use of the ObjectGraph to be created or injected into (so that it's dependency tree can be validated). Simplified, it's any type that is passed into an .inject or .create call.
from dagger.
Patrick Baumann wrote:
I've found that people pick the concept up quickest when I explain
that an entry point is any class that makes explicit use of the
ObjectGraph to be created or injected into (so that it's dependency
tree can be validated). Simplified, it's any type that is passed into
an .inject or .create call.
Did you mean .inject(Object) or .get(Class<?>)?
from dagger.
Heh, yes. My bad. Shows how rarely I use it in my code base.
from dagger.
graphNodes
?
from dagger.
I don't think graphNodes
covers the current behavior because every dependency in a node in the graph.
It may help to consider the definition & purpose of entry point. An entry point is a type that is a legal argument to ObjectGraph.get()
or ObjectGraph.inject()
. We require these to be explicitly registered so that the entire graph can be known statically; otherwise types defined in @Provides
modules is known statically but other types need to be created at runtime. Like Guice's JIT bindings.
Even if a node is not a graph root, we require an entry point for it if it's used in the two methods because otherwise code changes will have non-local effects. Removing a dependency may implicitly drop a node or series of nodes from the graph.
One other word that comes to mind is bootstrap. That's because the process of requesting injection from the object graph is a form of bootstrapping the application. For Android apps we need to do this in every module, but for most applications it should only happen in the main class.
from dagger.
I might call it "injects=..." The doc is "explicitly declares types this
module is capable of injecting."
Bob
On Mar 26, 2013 9:06 PM, "Jesse Wilson" [email protected] wrote:
I don't think graphNodes covers the current behavior because every
dependency in a node in the graph.It may help to consider the definition & purpose of entry point. An entry
point is a type that is a legal argument to ObjectGraph.get() or
ObjectGraph.inject(). We require these to be explicitly registered so
that the entire graph can be known statically; otherwise types defined in
@provides modules is known statically but other types need to be created
at runtime. Like Guice's JIT bindings.Even if a node is not a graph root, we require an entry point for it if
it's used in the two methods because otherwise code changes will have
non-local effects. Removing a dependency may implicitly drop a node or
series of nodes from the graph.One other word that comes to mind is bootstrap. That's because the
process of requesting injection from the object graph is a form of
bootstrapping the application. For Android apps we need to do this in every
module, but for most applications it should only happen in the main class.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/154#issuecomment-15503308
.
from dagger.
+1 to Bob's suggestion. Let's do that.
from dagger.
from dagger.
Related Issues (20)
- java.lang.NoClassDefFoundError: dagger.internal.Preconditions HOT 2
- java.lang.NoClassDefFoundError: dagger.internal.Preconditions HOT 1
- android.app.Application does not implement dagger.android.HasActivityInjector HOT 3
- --
- Android Context HOT 1
- Subcomponent inside subcomponent HOT 1
- Error when a component is trying to include bindings with different scopes could be more informative HOT 1
- Constructor injection cannot find symbol method inject members dagger2 2.14 HOT 1
- how can i run the example of CoffeeApp.java HOT 1
- Why do Singletons need an empty default constructor? HOT 2
- dagger-compiler
- dagger.android.DispatchingAndroidInjector cannot be provided without an @Provides HOT 1
- 每次修改完java代码都需要clean项目 才能运行, HOT 1
- did u consider this kind of case: ChildFragment needs to reuse ParentFragment's object instead of creating a new one。hilt may not support this kind of case
- duplicate Nullable HOT 2
- cannot generate
- Support extending base builder classes HOT 2
- The Hilt Android Gradle plugin is applied but no com.google.dagger:hilt-android dependency was found. HOT 1
- Issue with enableAggregatingTask flag / AGP 7.0 / oss-licenses HOT 1
- after add hilt { enableAggregatingTask = true } dependencies tasks faild
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dagger.