Comments (4)
Yes it cannot work like that.
superinterfaces
is a no brainer that adds the extends Interface
on the generated component.
I didn't add the support for extending a component because I think it's not something that you would do. If the parent component contains some inject(...)
methods, you don't want to inherit them, but only the exposed dependencies.
What I do is to create the exposed dependencies in a separated interface.
public interface ApplicationDependencies {
MyDep1 myDep1();
MyDep2 myDep2();
}
@Component
public interface ApplicationComponent extends ApplicationDependencies {
void inject(Application app);
}
The children components will extend the ApplicationDependencies
and not the component itself. Like this you avoid to inherit the method void inject(Application app)
@Component(dependencies = ApplicationComponent.class)
public interface ActivityComponent extends ApplicationDependencies {
void inject(Activity activity);
}
And with auto component:
@AutoComponent(dependencies = ApplicationComponent.class, superinterfaces = ApplicationDependencies.class)
public class MyActivity extends Activity {
}
I'm assuming this is the right way to do it, but I may be wrong.
from auto-dagger2.
Gotcha. Okay I guess you're right in this use case but I won't necessarily have an inject method to inherit, so it might be okay to support it - I mean I don't think this library should impose the way you write DI classes, but give you the power to mix it up a bit.
Thanks, great library:)
from auto-dagger2.
Valid point.
I'll include the support in the next version, beginning of January, as I'm quite busy right now.
Thanks for the feedback!
from auto-dagger2.
+1 for that feature
from auto-dagger2.
Related Issues (7)
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 auto-dagger2.