Thanks for the replies, but I don't think I'm understanding how these
approaches can bind each of the individual values when their types are
not known until runtime.

MapBinder looks like it will allow me to inject the whole Map, when
I'm interested in binding each value in the map.  The Properties idea
with type converters sounds neat, but I'd need to know the types at
development-time so I could write all the conversion code.

Suppose I have an app with three user preferences, one of which is a
List of custom beans, say Foobars.  I like to call them "dimensions"
for some business reason.

I need a "private List<Foobar> dimensions;" in a whole heap of classes.

My non-Guice solution is to have a singleton Dimensions with "public
static List<Foobar> getDimensions()".  Ugly and a real code smell!

At program start up I use java.beans.XML* to read/write my user
preferences to a ~/.myapp_prefs file.  I need the "glue" to get my
prefs each individually bound so they can all be injected
independently of each other.

I.e.:

@Inject
@named("dimensions")
private List<Foobar> dimensions;

put anywhere I want them.

Thanks,
 - Rich

-- 
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.

Reply via email to