Comment #1 on issue 601 by sberlin: requestStaticInjection should not imply a request for static injection on superclass members
http://code.google.com/p/google-guice/issues/detail?id=601

This would be a pretty large backwards incompatible change (it caused some problems with Gin recently, too). I could see a helper class doing it. Something like:

configure() {
   requestStaticInjection(SimpleStaticInjector.class);
   SimpleStaticInjector.inject(StaticFoo.class);
   SimpleStaticInjector.inject(StaticBar.class);
}

SimpleStaticInjector {
  List<Class> injections = Lists.newArrayList();
  void inject(Class clazz) {
    injections.add(clazz);
  }

  @Inject static doInjections(Injector injector) {
    for (Class clazz : injections) {
for (InjectionPoint ip : InjectionPoint.forStaticMethodsAndFields(clazz)) { // InjectionPoint's member belongs to the exact class (not a superclass) // then run through the logic from MembersInjectorStore.getInjectors.
        // basically:
        // if it's a field, get the sole dependency's Key from the injector
        // and set the field with it.
        // if it's a method, get an instance of each dependency and call the
        // method with those instances.
      }
    }
  }
}


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

Reply via email to