Comment #3 on issue 295 by [email protected]: @ProvidedBy doesn't work with
enums
http://code.google.com/p/google-guice/issues/detail?id=295
Here's an use-case if you need one. I have an enum that defines the various
runtime environments of my software and I use the system properties to
define the environment at startup. I'm currently using Module but
@ProvidedBy would be a much cleaner approach.
@ProvidedBy(EnvProvider.class)
public enum Env {
DEVELOPMENT,STAGING,PRODUCTION;
public static Env environment() {
String env = System.getProperty("my.env");
if (env != null) {
return Env.valueOf(env.toUpperCase());
}
return DEVELOPMENT;
}
public static class EnvProvider implements Provider<Env> {
public Env get() {
return Env.environment();
}
}
}
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" 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-dev?hl=en.