I'm working on a small class that will read in a Map<String,Object>
holding user preferences from a file. I would like each of these
entries to be injectable, so I'm looking at essentially:
(Pseudocode)
Map<String,Object> prefs = blah...
for(Map.Entries e : prefs.entrySet) {
String key = e.getKey();
Object val = e.getValue();
binder.bind(value.getClass())
.annotatedWith(Names.named(key))
.toInstance(val);
As you can imagine, things aren't working :-)
TypeLiteral<> doesn't seem like a solution because I won't know the
types of "val" until runtime.
Is there any provision to support this specific thing?
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice?hl=en.