bind(Reader.class)
.annotatedWith(DictionarySourceReader.class)
.toProvider(DictionarySourceProvider.class);
DictionarySourceProvider will provide a FileReader object, which will be injected to a DictionarySourceParser.
public class DictionarySourceParser {
private Reader sourceReader;
@Inject
DictionarySourceParser(@DictionarySourceReader Reader sourceReader) {
this.sourceReader = sourceReader;
}
public List<DictionaryEntry> parse() {
// Parsing entries from the reader ....
return entries;
}
}
I have two questions:
- When DictionarySourceParser is done with the Reader, who has the responsibility to close the reader? Should the parser be responsible?
- Is it a commonplace to inject a resource that should be cleaned-up after (e.g. Closable)? In general, who has the responsibility for the clean-up?
Cheers,Andree
Is it a commonplace to inject a resource that should be cleaned-up after (e.g. Closable)? In general, who has the responsibility for the clean-up?
--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice...@googlegroups.com.
To post to this group, send email to google...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/f293df1e-0653-4bcf-9841-e1c5dc281838%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to a topic in the Google Groups "google-guice" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-guice/rcUWE--TfRQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-guice...@googlegroups.com.
To post to this group, send email to google...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/CAO9V1MKVE96AxX6vYftRA92o7ObQn-K%2BO1jDbf4%2B-PeStmqu_g%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/B9FE2737-CB62-45D7-A006-71BD8E0EC548%40gmx.ch.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/CANEiXrpBz84KyBXn91qm_TFdtoBYvfPMsFgEOwa1-q0mPigCGw%40mail.gmail.com.