Hi there,
I have the following Guice binding in my application.
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:
1. When DictionarySourceParser is done with the Reader, who has the
responsibility to close the reader? Should the parser be responsible?
2. 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
--
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 [email protected].
To post to this group, send email to [email protected].
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/bc764248-c00d-47c2-8207-2fd45087b352%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.