frjaeger220 / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 0 forks source link

[RFE] Extend the Logger "special case" to any class #440

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I think that in the SPI, it should be possible to extend the "special case"
of the Logger so that any injected member can know the injectee in which it
will be injected.

For instance resources that should be injected would somewhere know how to
be fetched.

Currently, the only way of doing this is such as this:

private final Resources resources;
@Inject
public Injectee(ResourceManager resourceManager) {
  this.resources = resourceManager.getResources(getClass());
}

Not very recommended when I read the wiki's best practices.

Naming it isn't recommended since it would mean that we can't really
automatize the process, but would rather create the resource and assign it
to the name.

The Logger exception doesn't seem to be extremely long when I see the code
of InjectorShell.bindLogger(), so could it be a pain to develop it? But
maybe it would be a pain to find a useful way of doing this? I don't know.

If I get leads where to start, I might be able to develop an extension
doing this.

Original issue reported on code.google.com by ogregoire on 22 Oct 2009 at 11:44

GoogleCodeExporter commented 9 years ago

Original comment by sberlin on 25 Apr 2010 at 10:06