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

Referencing Guice injector instance #18

Open
Sanrag opened this issue Sep 21, 2013 · 2 comments
Open

Referencing Guice injector instance #18

Sanrag opened this issue Sep 21, 2013 · 2 comments
Labels

Comments

@Sanrag
Copy link
Contributor

Sanrag commented Sep 21, 2013

I'm trying to write a Builder pattern for PipelineIteration to make it flexible. I'd need to do injector.getInstance() for other dependencies of the class (Not sure if there's another cleaner approach). Is keeping a static reference to the injector in WorkhorseFactory a good approach for this? (Something like https://gist.github.com/Sanrag/5dfb106e89a4c4c54891 )

@matttproud
Copy link
Contributor

Can you explain the underlying need for this change? It'd help me understand what to propose. Alternatively, have you looked up "Guice factory" with scoping for common patterns? Alternatively, there is assisted injection which can build scoped factories. Not sure this helps, but maybe? Assuming the scoping works, I presume the factory approach will be fine.

@Sanrag
Copy link
Contributor Author

Sanrag commented Sep 22, 2013

The complete change is here Sanrag@71dcda9

I'm trying to make PipelineIteration flexible, so that you can choose what stages to execute depending on what you are tuning. However, to build an instance of PipelineIteration, you need some additional instances too - like PipelineSynchronizer and MetricExporter. I'm trying to find the best way to get them to the Builder class.

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

No branches or pull requests

2 participants